eleventy-plugin-syntaxhighlight
eleventy-plugin-syntaxhighlight copied to clipboard
BUG / FR / documentation: prism loading - possibility to load other languages; other prism components;
When adding the plugin and trying extending languages, only a few are available. Later on other languages will be accessible.
This is IMO a bug.
Adding new languages - init should be called after all other languages are loaded by the plugin (or prismjs)
Features I miss (some might just need documentation to be added):
- default language fallback (text) - at least for MD
- possibility to add aliases for languages
- possibility to tell which languages get's loaded
- also which components are loaded (like line highlight, line numbering, etc... although some might need extra plugin code)
eleventyConfig.addPlugin(syntaxHighlight, {
init: function({ Prism }) {
Prism.languages.console = Prism.languages.extend('markup', {});
Prism.languages.terminal = Prism.languages.extend('markup', {});
console.log('init', Object.keys(Prism.languages))
}
});
init [
'extend', 'insertBefore',
'DFS', 'markup',
'html', 'mathml',
'svg', 'xml',
'ssml', 'atom',
'rss', 'css',
'clike', 'javascript',
'js', 'console',
'terminal'
]
Later on languages include more: ruby,rb,yaml,yml,markdown,md,liquid,bash,shell,java,python,py
But still missing: cs, sql, ...
Came here for similar. I'm attempting to alias nunjucks
to jinja2
or twig
or django
, and this seemed the appropriate way. However if I log the keys of Prism.languages a variable amount are output each time.