@jgm I would go with possibility 3., with 1. as a second choice, based on the following notes…
Possibility 1. any class after opening code backticks
Performance & Maintenance Issue: Looks up each class against some ever evolving language name list, like PrismJs⇗ or highlight.js⇗ supported languages.
Possibility 2. use language-LANG in markdown
Breaks Markdown Editing Highlights Issue: Breaks source and preview highlighting in many markdown editing environments. Widely used markdown fenced code syntax uses just the language name: c, java, swift, etc as the first word after the opening code fence.
Here is an example from editing markdown in Atom:
Note: Requiring language- in markdown code fences breaks thousands of markdown files in my use case.
Possibility 3. use first word after opening code backticks
In my use case, the first word (if present) is the code language name.
Always add language- to a single word after the opening code backticks
Fenced C code in markdown input:
Renders HTML5 recommendation compliant output:
int i = 0;
Note: may need to recognize no-highlight (in markdown) as a case for not adding any language highlight class when multiple classes are used after an opening code fence. (Just mentioned from completeness … for use cases which also have non language classes... although this is not my current use case.)