microsoft / microsoft/monaco-editor
Monarch: assigning multiple tokens to a capturing group
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
I'm trying to improve my Monarch grammar for Markdown and I stumbled on the following problem.
In Markdown you can italic/bold/strikethrough text, using any combination of those styles on the same text, and the styled text can also contain something like an inline code block, an emoji, a link or something else. I want to provide perfect syntax highlighting for such cases.
The problem is that I don't think Monarch currently supports assigning multiple tokens to a single capturing group, so I can't quite highlight something like the following properly:
Strikethrough and bold with somecodeinside
I could in theory make dedicated tokens for each possible combination, but it would be kind of crazy, the combinations are just too many, plus I can't expect third-party TextMate themes, which I want to eventually support, to ship with all these combinations as well.
So can support for adding multiple tokens to a single capturing group be added?
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Monarch grammar and tokenization implementation, focusing on how capture groups currently receive tokens. Use the Markdown example in the issue to define the expected behavior; done means one capture group can represent multiple nested styles without requiring a token for every style combination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100