Alias for code block language tag?

I am (attempting to) write a plug-in for Obsidian, that renders javascript inside a code block tagged with canvas-api to a <canvas> element. I have a rudimentary version working here.

However, I would like to apply javascript syntax highlighting to that code block. I’m trying to work out how to add “canvas-api” as an alias for “javascript”, just as “js” is, for the purposes of syntax highlighting.

I think I’m trying to write a view plug-in, but beyond that, any pointers would be highly appreciated.

many thanks!!

Sounds like the codeLanguages option to markdown() is what you need.

1 Like