Repository navigation
feat: support ==text== highlighting in the GFM flavour - #230
Merged
Merged
Conversation
Peter Gromov (donnerpeter)
approved these changes
Sep 25, 2026
Add a GFM extension that parses `==highlighted text==` into a HIGHLIGHT element rendered as the HTML `<mark>` tag, an official alternative to `<mark>` in extended Markdown syntax. - Lex `=` as a separate token (GFMTokenTypes.EQUALS) and allow escaping it with a backslash; the GFM lexer is regenerated from gfm.flex with JFlex 1.9.2 and the IntelliJ skeleton - Parse runs of exactly two `=` with HighlightDelimiterParser, mirroring StrikeThroughDelimiterParser: `=text=` and `===text===` stay plain text - Render HIGHLIGHT as `<mark>` in GFMFlavourDescriptor Fixes IJPL-175082 Produced by Air Automations. Name: Markdown library: fix the bug / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/cb6a17f6-e7a9-41a8-9611-7c95c4eb0141?run=faef9ac2-8bf0-4db1-8e17-4dce310f599f
Peter Gromov (donnerpeter)
force-pushed
the
gfm-highlight-support
branch
from
September 25, 2026 08:59
a591a25 to
19b84d8
Compare
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.
Fixes IJPL-175082:
==...==syntax is not rendered as highlighted, while being an official extended-syntax alternative to the HTML<mark>tag.What
Adds
==text==highlighting toGFMFlavourDescriptor, following the same pattern previously used for strikethrough and math:=is now lexed as a separate token (GFMTokenTypes.EQUALS) instead of being merged intoTEXT, and\=was added to the backslash-escape rule (CommonMark treats every ASCII punctuation character as escapable)._GFMLexer.ktis regenerated fromgfm.flexwith the IntelliJ JFlex 1.9.2 fork andidea-flex.skeleton; the regeneration toolchain was validated by first reproducing the committed lexer byte-for-byte from the unmodifiedgfm.flex.HighlightDelimiterParser(mirroringStrikeThroughDelimiterParser) participates inEmphasisLikeParserand produces aGFMElementTypes.HIGHLIGHTnode. Only runs of exactly two=count, so=text=and===text===stay plain text, matching markdown-it-mark/Obsidian behavior.HIGHLIGHTrenders as<mark>via the existingEqualDelimiterTrimmingInlineTagProvider.Like the earlier math support, the token is added to the GFM lexer only;
SFMFlavourDescriptorinherits the parser but its lexer emits noEQUALStokens, so its behavior is unchanged.AST note
=characters in inline text are now separate=tokens instead of being merged into adjacentTEXTtokens (the same kind of change~and$introduced). Two existing parser goldens (math.txt,gfmTableWithBlockQuote.txt) were regenerated accordingly; rendered HTML is unaffected.Testing
testHighlightinMarkdownParsingTest) and HTML test (testHighlightinHtmlGeneratorCommonTest) covering: basic and multi-word highlights, single/triple/quadruple=, intraword, adjacent pairs, backslash escapes, unclosed delimiters,=in plain text and URLs, nesting with strong/strikethrough/links/code spans, and a setext heading regression case.Produced by Air Automations. Name: Markdown library: fix the bug / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/cb6a17f6-e7a9-41a8-9611-7c95c4eb0141?run=faef9ac2-8bf0-4db1-8e17-4dce310f599f