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

Apply Syntax Hilighting to Code Snippets #33

Open
gfs opened this issue Feb 15, 2022 · 2 comments
Open

Apply Syntax Hilighting to Code Snippets #33

gfs opened this issue Feb 15, 2022 · 2 comments

Comments

@gfs
Copy link

gfs commented Feb 15, 2022

It would be great for embedded snippets to have syntax highlighting applied to them to make it easier to read the code.

@jeffersonking
Copy link
Collaborator

We do have limited syntax highlighting (code). I say "limited" as we are constrained by two things:

  • Frequently the code snippet is incomplete in a way confuses the syntax highlighter.
  • For payload/performance reasons, we stopped included all hljs languages by default in our componment.

Which language in particular are you having issues with? Perhaps we can make a tactical fix. Thanks!

@gfs
Copy link
Author

gfs commented Feb 22, 2022

I've noticed that C# doesn't seem to work correctly. This is a screenshot from the component as embedded on Dev Ops. You can see that the n in new is blue but not the whole keyword, additionally the class/method call isn't colored.

image

I've had good results with prism.js for highlighting.

Here's the same sarif loaded and the snippet highlighted with prism (the colors are configurable):
image

https://prismjs.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants