Syntax Highlighting

#39 · closed · 3 comments

View on GitHub ↗

nandac

Dear Folks, I would like to know how you have built syntax highlighting for Typst. I am trying to build Syntax highlighting for Kate, which requires the building of an XML file of all the keywords available in the language which is difficult to do by hand. I would like to know how you handle syntax highlighting and updating it as Typst changes. I hope you can guide me in this regard. Many thanks.

Comments

olib14

I'm a KDE contributor. There's no way to do this for Kate but to create an XML file defining the syntax: https://invent.kde.org/frameworks/syntax-highlighting/-/tree/master/data/syntax Interestingly enough some time ago I looked into the same thing and also found it to be difficult enough not to bother. I was interested in building a Qt app similar to Kile for Typst editing, with Kate and Okular parts. This project seems to handle it here: https://github.com/Cubxity/typstudio/blob/master/src/lib/editor/lang/typst-tm.json

nandac

@olib14 Thanks for the info. I guess I can build it by hand incrementally but it is going to take a while. If I do find an automatic way I will recommend the Kate developers to add a HOWTO.

olib14

Sure thing. Feel free to tag me on KDE's GitLab `@olib` if you ever make an MR - I'd be happy to test syntax highlighting. Make sure to close this issue!