Skip to content

fix: parse block quote markers of table lines as BLOCK_QUOTE tokens (IJPL-95908) - #232

Open
jetbrains-air[bot] wants to merge 1 commit into
masterfrom
fix/ijpl-95908-blockquote-markers-in-table
Open

jetbrains-air[bot] wants to merge 1 commit into
masterfrom
fix/ijpl-95908-blockquote-markers-in-table

Conversation

@jetbrains-air

@jetbrains-air jetbrains-air Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Fixes IJPL-95908: removing a row / column in a table inside a block quote breaks the table.

Root cause

For a table inside a block quote, only the first > marker got a BLOCK_QUOTE token production (via populateConstraintsTokens). The > markers of the separator line and of every data row fell into the gaps between block-level productions, and TreeBuilder/TopLevelBuilder.addRawTokens fills such gaps with WHITE_SPACE tokens.

In the IDE those markers therefore ended up inside PsiWhiteSpace nodes (MarkdownParserDefinition.getWhitespaceTokens() includes the library WHITE_SPACE). The table actions themselves don't touch the prefixes — but the whitespace regeneration that the platform performs after a PSI mutation can only emit real whitespace, so the > markers were silently dropped, breaking the block quote markup and the table with it. A plain table survives the same mutation, which is why the bug shows only inside a block quote.

Fix

GitHubTableMarkerBlock now emits a BLOCK_QUOTE token production for each quote marker (plus one following space, when eaten by the constraints) on every table continuation line, matching how the markers are represented outside of tables:

Markdown:EOL('\n')
WHITE_SPACE('   ')
Markdown:BLOCK_QUOTE('> ')
Markdown:ROW

previously:

Markdown:EOL('\n')
WHITE_SPACE('   > ')
Markdown:ROW

Pure indentation (tables in list items) intentionally stays WHITE_SPACE.

Testing

  • New testTableInsideBlockQuote parsing test covering the exact reproducer from the issue (>| without a space) and a nested >>| block quote.
  • Updated expected trees of testTableInsideBlockQuoteWithMissingLastPipe and testTableInsideBlockQuoteInListItem — only the token type of the > prefixes changed.
  • Full jvmTest suite passes (1566 tests), including the GFM spec suite: HTML generation is unaffected because TablesGeneratingProvider only consumes HEADER/ROW/TABLE_SEPARATOR children.

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=e31aa195-850b-47a7-8b0b-bc40ea2ca4a5

🤖 Generated with Claude Code

…IJPL-95908)

For a table inside a block quote, the '>' markers of every line after the
header ended up in the gaps between block-level productions, and TreeBuilder
fills such gaps with WHITE_SPACE tokens. In the IDE these markers therefore
landed inside PsiWhiteSpace nodes; whitespace regeneration after a PSI
mutation (e.g. the remove row / remove column table actions) can only emit
real whitespace, so the '>' markers were lost and the block quote markup
broke together with the table.

Now GitHubTableMarkerBlock emits a BLOCK_QUOTE token production for each
quote marker eaten by the line constraints of a table continuation line,
matching how the markers are represented outside of tables. HTML generation
is unaffected: TablesGeneratingProvider only consumes HEADER / ROW /
TABLE_SEPARATOR children.

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=e31aa195-850b-47a7-8b0b-bc40ea2ca4a5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@p3rmiashkin

Copy link
Copy Markdown
Contributor

Seems to be duplicated of #231 :( Peter Gromov (@donnerpeter) WDYT?

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving verdict from my side — no blocking findings! (Posted as a comment because GitHub does not allow this account to formally approve its own PR.)

Produced by Air Automations. Name: Markdown library: review the PR / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/2269eaa4-da15-4cac-957f-3341151c79ec?run=c915e52e-62ca-4c77-9351-57b81d857d7c

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant