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

Hijacking Markdown code block highlighting #297

Description

@thaliaarchi

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions