How to Add another language for highlighted code blocks

Things I have tried

I would like to insert code from a PLC programming language called Structured Text. I have enclosed the code using 3 back-quote characters and have specified Pascal as the language. The Structured Text language is similar to Pascal, so the highlighting works fairly well but is not perfect.

What I’m trying to do

I would like to take the Pascal definition file and modify it for Structured Text for my purposes and to submit it for inclusion in Obsidian or as an Obsidian plugin.

Any hints or guidance would be appreciated.

Thanks
Rick

Are you sure it’s not supported? Try using iecst as the language specifier.

It’s kind of hard to read, but Structured text language support by Serhioromano · Pull Request #2310 · PrismJS/prism · GitHub indicates that Structured text for PLC programming, should have been included into the prism engine some time ago, so I reckon it should also have made it into Obsidian.

Here is an example I just typed in (hoping that is Structured text code):
image

Thanks for the tip to use “iecst”. The one thing I notice is that Pascal and other languages are highlighted when in edit or auto preview mode. This only works when in read only mode. Perhaps this belongs on a list of things to fix somewhere.

I’m delighted that it works but it would be even better if it worked like other languages.
:smiley:

I can see that too that it doesn’t color iecst in live preview mode, but I’ve got no idea why it behaves like that. Not sure if that is an issue within Obsidian, or the backend library of prismJs.

@rigmarole , do you have any idea about this, and/or what is your suggestion for further investigation/reporting?

No idea here. I’m not sure if the devs have anything to do with Prismjs. I certainly don’t.

1 Like

After some more digging I found this post:

In essence, it says that syntax highlighting in live preview is done by Codemirror 6, whilst syntax highlighting in the reader is done by primsJs. And they don’t necessarily support the same languages, and it’s not easy to get to them support the same languages.

So for syntax highlighting (for “iects”) to work in live preview, someone needs to extend the language support within Codemirror 6.