Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talon syntax highlighting #255

Open
C-Loftus opened this issue Apr 6, 2024 · 4 comments
Open

Talon syntax highlighting #255

C-Loftus opened this issue Apr 6, 2024 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@C-Loftus
Copy link
Member

C-Loftus commented Apr 6, 2024

If someone is good at regex it would greatly help us and make the wiki nicer if we could port vscode format from https://github.com/mrob95/vscode-TalonScript/blob/master/syntaxes/talon.tmLanguage.json into the prism syntax.

All the highlighting just goes within the prism-talon.js file and uses the syntax as defined by https://prismjs.com/extending.html

Since Prism uses a different syntax unfortunately most content from the vscode addon has to be edited a little bit. However, the vscode addon is a very good start.

If anyone is good at regex and wants to help, that would be super helpful. Ping me if you have any questions and want to help.

@C-Loftus C-Loftus added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 6, 2024
@Nova38
Copy link
Contributor

Nova38 commented Jul 6, 2024

There might also be the potential to use the vscode theme directly via shikjs https://github.com/shikijs which uses the same render as vscode. It might need a little work to get it to work, but it does have a official rehype plugin I think.

It's uses is also discussed here:
facebook/docusaurus#9122

@C-Loftus
Copy link
Member Author

C-Loftus commented Jul 6, 2024

Looks cool, not sure how much bandwidth that will take. We have most of the logic for syntax highlighting so I am thinking it might just be easier to port the existing regexes to the prism syntax. But definitely good to know and if someone does want to tackle this at some point, certainly fine with whatever is easier.

@Nova38
Copy link
Contributor

Nova38 commented Jul 6, 2024

Fair enough, I will take a shot at it here in a week or two. I'm settling into a new job. I am also am gonna be finishing up an addition to the talondoc repo to use the treesitter bindings she made to get syntax highlighting working with pygments and sphinx.bIts mostly done from a year or so. After that I can probably give this a shot.

@Nova38
Copy link
Contributor

Nova38 commented Nov 27, 2024

I have been playing around with getting the prism.js language definition to work, but I am not sure that it will be anywhere near as good as the textmate Grammer due to the limitations of the prisms.js parser. To make it I ended up modifying the existing python Grammer, it uses JavaScript Regex as apposed to the one used by the textmate which have a lot of drawbacks. Most importantly it doesn't handle the context header part of the document well. The textmate Grammer that we have is also a lot better at handling parseing the Regex expressions.

I am working on trying to get the shiki library to work. It is looking promising. There is a small bug upstream in docusouras with they way they are loading modules with jiti that is being worked on in the issue I mentioned above. Ones that is done it should be mostly working. Someone else got it working here https://lachieh.github.io/docusaurus-with-shiki-rehype/docs/intro.

Also I have gotten the textmate gramer included in the shiki repo where they have the included languages. It was pretty easy as I had already gotten it included in GitHub's linquist a year and a half ago or so.

They also recently added a feature to colorizez brackets like in vscode so that it is easier to see the pairs of them. I think that would be expesially helpful when it comes to the brackets used in TalonScript for the rules.
https://shiki.style/packages/colorized-brackets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants