Cubxity / typstudio

A W.I.P desktop application for a new typesetting language, typst.
GNU General Public License v3.0
605 stars 19 forks source link

Syntax Highlighting #39

Closed nandac closed 10 months ago

nandac commented 10 months ago

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.

olib14 commented 10 months ago

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 commented 10 months ago

@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 commented 10 months ago

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!