sarif-web-component
sarif-web-component copied to clipboard
Apply Syntax Hilighting to Code Snippets
It would be great for embedded snippets to have syntax highlighting applied to them to make it easier to read the code.
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
hljslanguages by default in our componment.
Which language in particular are you having issues with? Perhaps we can make a tactical fix. Thanks!
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.
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):

https://prismjs.com/