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

LF Code Syntax Highlighting for Handbook #5

Closed
arengarajan99 opened this issue Jan 28, 2022 · 5 comments
Closed

LF Code Syntax Highlighting for Handbook #5

arengarajan99 opened this issue Jan 28, 2022 · 5 comments

Comments

@arengarajan99
Copy link
Collaborator

Improvement Idea: Implementing Code Syntax Highlighting for Lingua Franca Code Snippets using PrismJS

Why: VS Code already implements Code Syntax Highlighting for .lf files. Remark-PrismJS is the standard Gatsby Plugin used to highlight code on Gatsby websites, and it's possible to create a custom language that Prism can process for code snippets

@arengarajan99 arengarajan99 changed the title Idea: LF Code Syntax Highlighting for Handbook Jan 28, 2022
@lhstrh
Copy link
Member

lhstrh commented Jan 29, 2022

The syntax highlighting in VS Code is a lot more advanced than what is possible with prismjs, which is really just based on regular expression matching. Is there a way to leverage artifacts of the actual VS Code extension, like its TextMate grammar?

@lhstrh
Copy link
Member

lhstrh commented Jan 29, 2022

I found this, but it says it's not ready for production use.

@lhstrh
Copy link
Member

lhstrh commented Jan 29, 2022

So, yeah, maybe Prism is the way to go for now? Let me also tag @petervdonovan in case he has ideas about this.

@petervdonovan
Copy link
Contributor

Is there a way to leverage artifacts of the actual VS Code extension, like its TextMate grammar?

In the spirit of staying DRY, maybe we could use the grammar file interpreter that is used in VS Code? That, combined with the non-declarative highlighting code, should be able to precisely match the highlight experience for VS Code users.

There are some problems with this. Apparently, "cross - grammar injections are currently not supported," but we need cross-grammar injections to highlight {= =} code blocks. I would be willing to help iron out these wrinkles so that we do not have to maintain multiple highlighters at once.

@petervdonovan
Copy link
Contributor

This should be addressed by #11.

lhstrh pushed a commit that referenced this issue Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants