Add New Syntax Elements for Markup
I was thinking that it might be a good idea to add some new elements targetting markup syntaxes, like
Currently, Highlight langDefs seem centered on programming languages, providing syntax elements that cover the common token types of languages.
Although there's no limit to the number of keywords a syntax might define, the average theme only covers about 4-5 keywords styles in all, which in practice means that styles relying on more than 5 keywords are likely to be uncovered by most themes.
Also, another reason why I think markup elements deserve special syntax elements is because there are expectations as how they should be styled —
Italics in emphasis,
Bold in strong, etc. — whereas keywords groups could be styled in any way really.
Just consider the sheer amount of plaintext lightweight markup languages that are used by programmers — markdown, AsciiDoc, reST, and many others — in contexts that range from documentation to documenting code via comments, Wikis, blogs, etc.
Highlight.js offers specific classes for markup elements, ad documented in CSS classes reference:
bullet— list item bullet in text markup
code— code block in text markup
emphasis— emphasis in text markup
strong— strong emphasis in text markup
formula— mathematical formula in text markup
link— hyperlink in text markup
quote— quotation in text markup
Some of these might be worth candidates as additional native Highlight syntax elements. Their addition wouldn't break backward compatibility, but it would allow some syntaxes to be udpated to improvde them.
Beside the already mentioned styling benefits regarding text styles, elements like
formula might also allow users to pick special fonts that contain scientific formula glyphs, for example. The
link element could be exploited by JS scripts to add interactivity to the highlighted code.