fix: disable syntax highlighting for code blocks without language specifier#30
Open
codeananda wants to merge 1 commit intoMarkEdit-app:mainfrom
Open
Conversation
Author
…cifier Code blocks without a language specifier (just triple backticks) were getting unwanted syntax highlighting due to highlight.js auto-detection. Words like "NATURAL", "Type", "OR", "trigger" were being coloured as programming keywords. The fix intercepts code blocks with empty `lang` before they reach highlight.js and renders them as plain `<pre><code>` without hljs classes. Also adds vitest testing infrastructure with tests covering: - Plain code blocks (no hljs classes) - Code blocks with language (syntax highlighting applied) - Mermaid blocks (render as div)
ddc8588 to
43d8264
Compare
Contributor
|
Thank you for submitting the PR. While the change serves its purpose, I believe we should address the following points:
To resolve these, would you be open to merging this PR and repurposing your PR to focus solely on adding the tests? Looking forward to hearing your thoughts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Code blocks without a language specifier (just triple backticks) were getting unwanted syntax highlighting due to highlight.js auto-language detection. Words like "NATURAL", "Type", "OR", "trigger", "within" were being coloured as if they were programming keywords.
This was likely worsened by the recent dependency upgrade (commit 65e2616).
Changes
langin the fence renderer to skip highlight.js processing<pre><code>without hljs classesTest plan
yarn test)yarn lint)yarn build)