Specifying language of fenced code blocks using info string


(FichteFoll) #1

From Github I am used to specifying the language of the code block in the “info string” (name from commonmark spec), but it seems that Discourse does not do this. At least not this and the other Discoruse instance I am using.

When I inspect the resulting <pre><code> block it always has lang-auto set.

Examples

The following is YAML and has ```yaml specified, but is highlighted as CSS:

- include: scope:source.c#cparens

The following is (again) YAML and has ```yaml specified, but is highlighted as PHP:

- include: scope:source.c#parens

This post in raw format.


(Jeff Atwood) #2

Depends what languages are allowed, we don’t carry the hundreds of kilobytes necessary to highlight every possible language. Check your site settings.


(FichteFoll) #3

Could you perhaps improve UX in the sense that trying to highlight code as a non-supported (or non-enabled) language gets seen by the user?