Discourse syntax highlighting options

Hi folks,

I have no clue how this platform, especially the syntax highlighting for block quotes here, works under the hood and how configurable it is, so I thought I’d ask right away:

What are the options for block quote highlighting (or where can I find them) and is there a highlighting for @code_warntype like output? If not, how hard would it be to make this possible?

I’m asking because of posts that sometimes appear in discussions mainly about code optimisation like this post:

Which would be much easier to grasp if the highlighting would reflect what @code_warntype does.

Thanks in advance

2 Likes

The highlighting is done with highlight.js. You can probably write a custom “julia-code-warntype” plugin, but to me it looks like the regular julia highlighter does a pretty good job with @code_warntype output?

1 Like

Oh it does a magnificent job at discerning code from type annotations and those pseudo-nodes. The thing that is missing, and that separates @code_typed from @code_warntype is the highlighting of non-leaf types: Unions with Missing or Nothing in yellow and all other Unions (and Any) in red.
Unfortunately, I have no experience with Javascript whatsoever, so that’ll have to wait.