Skip to content

Enhance Typst Language Support #87

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

Open
FlandiaYingman opened this issue Apr 13, 2025 · 1 comment · May be fixed by #88
Open

Enhance Typst Language Support #87

FlandiaYingman opened this issue Apr 13, 2025 · 1 comment · May be fixed by #88
Assignees

Comments

@FlandiaYingman
Copy link

Is your feature request related to a problem? Please describe.

The current Typst language support is a regex-based character-by-character text builder. Since Typst allows scripting within math mode and markup mode, it makes it difficult to parse and annotate with only a regex-based parser.

For a large Typst document, it is usual that the program fails to parse at the middle of the document because some markup/code/math transitions are not well-detected, causing an weird and funny output.

Describe the solution you'd like

I think I can write a simple recursive descent parser so that nested markup/code/math transitions are correctly parsed. Since this doesn't involve building an abstract syntax tree, but separating only markup and text, I think it is not difficult to implement one.

Describe alternatives you've considered

I tried to enhance the current regex-based parser for my large document, but failed due to the complexity of markup/code/math transitions.

Additional context

Is such a PR welcome?

@spitzerd
Copy link
Contributor

Sure, such a PR is welcome.

@FlandiaYingman FlandiaYingman linked a pull request Apr 15, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants