johannschopplich / kirby-highlighter

🌐 Server-side syntax highlighting for the code block & KirbyText
https://kirbyseo.com
MIT License
20 stars 4 forks source link

Some languages are skipped in code block #25

Open kaltschnitt opened 2 months ago

kaltschnitt commented 2 months ago

Some languages (for example "html, js") are skipped in the code block snippet, because – in this case – "html" or "js" are not included in the array returned by the Highlighter method listRegisteredLanguages(). "js" is the default value for JavaScript in the code block blueprint. The result is that the language is marked as "plaintext" which is not what we want.

There are two ways to fix this:

  1. Remove the if-statement in the block snippet
  2. Update the method listRegisteredLanguages() include the missing languages

Quick update on this: I've looked into the highlight.js class and and saw that the listRegisteredLanguages() method can return the languages with aliases passing a boolean param. So just update the code block snippet with listRegisteredLanguages(true) and we are fine.

johannschopplich commented 2 months ago

I'm not actively developing this plugin anymore. Only maintenance. PR happily welcome!