Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Hijacking Markdown code block highlighting #297

Open
thaliaarchi opened this issue Nov 16, 2023 · 0 comments
Open

Hijacking Markdown code block highlighting #297

thaliaarchi opened this issue Nov 16, 2023 · 0 comments

Comments

@thaliaarchi
Copy link

thaliaarchi commented Nov 16, 2023

The reason-markdown-codeblock.json syntax injects Reason syntax highlighting into Markdown ``` fences with a language ID of re, reason, or reasonml. Or, at least, that's what it's supposed to do. In reality, any match of the pattern (re|reason|reasonml)(\s+[^`~]*)?$ in an unhighlighted Markdown code block will assign the highlighting of the rest of the code block to Reason. The problem is with the start pattern for the syntax injection, at .repository.reason-code-block.begin.

I've encountered this intermittently over a couple of years, but as I recently wrote a language extension for VS Code, I fired up “Developer: Inspect Editor Tokens and Scopes” and quickly found the issue. See how the scope changes to meta.embedded.block.reason after writing re earlier in the code block. (Although my theme is Adapta Nocto, I tested that it has the same behavior with the default.)

reason_markdown_hijack

I'm aware of this extension's deprecation and expect nothing to come of this, but I figured I'd report it, since I had already triaged it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant