Skip to content

fix(core): merge task-item wrapped continuation lines instead of dropping them - #8016

Open
codewithsupra wants to merge 1 commit into
ueberdosis:mainfrom
codewithsupra:fix/task-item-wrapped-continuation-markdown
Open

fix(core): merge task-item wrapped continuation lines instead of dropping them#8016
codewithsupra wants to merge 1 commit into
ueberdosis:mainfrom
codewithsupra:fix/task-item-wrapped-continuation-markdown

Conversation

@codewithsupra

@codewithsupra codewithsupra commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes

Fixes #7909

Changes and Review

  • Task-item continuation lines indented under - [ ] were dedented incorrectly, leaving 4+ leading spaces — which CommonMark parses as an indented code block and silently drops.
  • Continuation lines now merge into the item's paragraph instead of being treated as nested content.
  • Regression tests added; they fail with the fix reverted.

Checklist

  • I have added a changeset if necessary.
  • I have added tests if possible.
  • I have made sure to test my changes myself.

Responsibility

  • I have reviewed and understand these changes, and I take responsibility for this PR, even if an AI agent created it.

…ping them

Fixes ueberdosis#7909

A task-item continuation line aligned under the marker's text column
(e.g. six columns for `- [ ] `, a common authoring style that LLMs
also emit) was collected as nested content and dedented by a fixed
`indentLevel + baseIndentSize` amount. When the continuation was
indented more than that, >= 4 residual leading spaces survived, so
marked parsed the line as an indented code block — which cannot
interrupt a paragraph in CommonMark, so the line was silently dropped
(outright data loss on parse, worsening on every markdown round-trip).

parseIndentedBlocks now peels leading lazy paragraph-continuation lines
(non-blank lines directly following the item text that are not
themselves block starts) into the item's mainContent, which the caller
tokenizes inline — so they merge into the item's paragraph as a single
paragraph, matching CommonMark renderers. Remaining genuinely-nested
content is dedented by its common minimum indentation rather than a
fixed amount, so a nested block indented past the base is no longer
left with residual whitespace either. An isBlockStart() guard keeps
real nested list items, blockquotes, fenced code, headings, and
thematic breaks parsing as nested blocks.

Adds regression tests (single- and multi-line continuation merge, plus
a guard that a genuine nested task item still nests). Verified the two
merge tests fail with only the source reverted and pass with the fix.
Full markdown + core + extension-list suites (808 tests) pass.
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6f3059d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 72 packages
Name Type
@tiptap/core Patch
@tiptap/extension-audio Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/react Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-color Patch
@tiptap/extension-font-family Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-placeholder Patch
@tiptap/pm Patch
@tiptap/starter-kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 6f3059d
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/6a509bf04506e900085465a6
😎 Deploy Preview https://deploy-preview-8016--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@arnaugomez

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 319472b8-88c3-4bdb-8686-729ca2869a5d

📥 Commits

Reviewing files that changed from the base of the PR and between ecc0d40 and 6f3059d.

📒 Files selected for processing (3)
  • .changeset/fix-task-item-wrapped-continuation.md
  • packages/core/src/utilities/markdown/parseIndentedBlocks.ts
  • packages/markdown/__tests__/task-item-wrapped-continuation.spec.ts

📝 Walkthrough

Summary

  • Fixed Markdown task-list continuation lines being dropped as code blocks.
  • Continuation lines now stay in the task item’s paragraph.
  • Genuine nested blocks, such as lists and blockquotes, remain nested.
  • Added regression tests for single-line, multi-line, and nested task items.
  • Added a patch changeset for @tiptap/core.

Walkthrough

Task-item markdown parsing now merges aligned continuation lines into the item paragraph, preserves genuinely nested blocks through common-indentation dedenting, and adds regression tests for wrapped and nested task items.

Changes

Task-item continuation parsing

Layer / File(s) Summary
Continuation and nested-block parsing
packages/core/src/utilities/markdown/parseIndentedBlocks.ts
Adds block-start detection, merges lazy paragraph continuations into task-item content, and dedents remaining nested content by its minimum shared indentation.
Regression coverage and release metadata
packages/markdown/__tests__/task-item-wrapped-continuation.spec.ts, .changeset/fix-task-item-wrapped-continuation.md
Tests single-line and multi-line wrapped continuations while confirming nested task items remain nested; records the @tiptap/core patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: area: markdown, complexity: medium, impact: medium

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix for wrapped task-item continuation lines.
Description check ✅ Passed The description matches the template and includes fixes, changes, tests, and checklist items.
Linked Issues check ✅ Passed The code and tests match #7909 by merging task-item continuations, preserving nesting, and dedenting by actual indentation.
Out of Scope Changes check ✅ Passed The PR stays focused on the bug fix, test coverage, and required changeset with no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

Comment on lines +187 to +197
// Peel off leading lazy paragraph-continuation lines into the item's main
// content. A soft-wrapped line that directly follows the item's text — no
// blank line separating it, and not itself the start of a new block — is a
// continuation of the item's paragraph in CommonMark, not new nested
// content. Authors (and LLMs) commonly align such wrapped lines under the
// marker's *text* column (e.g. six columns for `- [ ] `). Previously these
// were treated as nested content, dedented by a fixed amount that left >= 4
// residual spaces, and parsed by `marked` as an indented code block — which
// cannot interrupt a paragraph, so the line was silently dropped. Merging
// them into `mainContent` (which is tokenized inline by the caller) yields a
// single paragraph, matching CommonMark renderers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make the explanatory comments more concise. Explanatory comments should help understand the code. If they are too long, they have the opposite effect of decreasing legibility.

Do not mention the previous behavior: "Previously these were treated as nested content..."

Do not mention irrelevant info: "Authors (and LLMs)..." is irrelevant, it doesn't matter who wrote the markdown content.

Make the language simple and clear to understand. A beginner developer would not know what "Peel off" means.

Comment on lines +217 to +222
// Dedent by the smallest leading indentation shared by the non-blank
// nested lines rather than a fixed `indentLevel + baseIndentSize`, so a
// genuinely-nested block indented past `indentLevel + baseIndentSize` is
// not left with residual leading whitespace (which `marked` would parse
// as an indented code block). Deeper content keeps its relative
// indentation.

@arnaugomez arnaugomez Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here. This comment is very hard to understand. Make it clearer, make the sentences shorter. TWrite the explanatory comment yourself, do not have an LLM write it for you.

@bdbch
bdbch requested a review from a team as a code owner July 30, 2026 09:19
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.

Markdown: task-item wrapped/indented continuation lines render as code blocks

2 participants