Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bx-code-snippet]: Component Enhancements #11121

Closed
2 tasks done
andy-blum opened this issue Sep 28, 2023 · 1 comment
Closed
2 tasks done

[bx-code-snippet]: Component Enhancements #11121

andy-blum opened this issue Sep 28, 2023 · 1 comment
Assignees

Comments

@andy-blum
Copy link
Member

andy-blum commented Sep 28, 2023

The problem

There's been a request in the AEM platform for use of the code-snippet component for use in technical writing. A couple of component improvements that have been brainstormed are adding the option for text-wrapping (instead of overflowing the x-axis) and syntax highlighting for ease of readability.

The solution

I'm envisioning these as opt-in features like so:

<bx-code-snippet language="scss" wrap>
@mixin grid-container {
  width: 100%;
  padding-right: padding(mobile);
  padding-left: padding(mobile);

  @include breakpoint(bp--xs--major) {
    padding-right: padding(xs);
    padding-left: padding(xs);
  }
}

$z-indexes: (
  modal : 9000,
  overlay : 8000,
  dropdown : 7000,
  header : 6000,
  footer : 5000,
  hidden : - 1,
  overflowHidden: - 1,
  floating: 10000
);
</bx-code-snippet>

lang="scss" can be used to dynamically import highlight JS assets to help apply syntax highlighting
wrap can be used to enable text wrapping within the component instead of overflowing the width of the component

Application/website

https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/carbon-web-components/?path=/story/components-code-snippet--multi-line

Business priority

Low Priority = release date is not dependent on fix or not upcoming

What time frame would this ideally be needed by (if applicable)

No response

Examples

No response

Code of Conduct

@kennylam kennylam transferred this issue from carbon-design-system/carbon-for-ibm-dotcom Oct 2, 2023
@tw15egan
Copy link

tw15egan commented Oct 2, 2023

Hey @andy-blum! Text wrapping is already supported through the wrapText prop. As far as syntax highlighting goes, we've had a few discussions about this, but ultimately have left it up to product teams to determine a syntax highlighting theme that works best for their use-case. CodeSnippet should work with libraries like https://prismjs.com/ and https://highlightjs.org/, but please let us know if that is not the case.

@kennylam kennylam self-assigned this Nov 6, 2023
@sstrubberg sstrubberg transferred this issue from carbon-design-system/carbon Nov 10, 2023
@andy-blum andy-blum closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Triage to Done in Carbon for IBM.com Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants