Skip to content

fix(Markdown): keep loose fenced blocks in list items - #6656

Closed
ernestt wants to merge 1 commit into
mainfrom
markdown-upgrade/01-loose-fences
Closed

ernestt wants to merge 1 commit into
mainfrom
markdown-upgrade/01-loose-fences

Conversation

@ernestt

@ernestt ernestt commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Authors can put a blank line before a fenced code block, paragraph, or nested list inside a list item, and that block stays in the item in both full and streamed rendering.

Problem and solution fit

The block parser ended every list item at a blank line, so indented blocks after it escaped the item and indented fences rendered as stray text. An item now continues after blank lines when the next line reaches the marker's content indent (CommonMark spacing). Tight nesting, including two-space bullets under ordered items, is unchanged. Streaming settles completed blocks inside open list items by resuming the real block parser, so long items stay incremental.

Expected behavior and authority

Markdown component contract FR11 (streaming convergence) and FR23 (supported dialect); AST-036 FR21–FR23 (no duplicate callbacks, parser budgets, exact tracked performance records unchanged).

Writing rubric results

  • R1 narration: none; the new FR23 clause and verification note state current behavior in the present tense.
  • R2 research: none in the record.
  • R3 evidence: the verification note names coverage (streaming splits and work counts), not changes.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.

Smallest restoration

Teach full and incremental parsing to retain blank-separated blocks that reach the owning list marker's content indent, while preserving tight nesting, parser callback counts, streaming convergence, and tracked performance budgets.

Evidence

  • Streaming equals the full parse at every character and two-chunk split, with LF and CRLF and with or without source ranges: paragraphs, nested lists, open and closed item fences, display math across blank lines, whitespace-only blank lines, definitions, and syntax plugins.
  • A syntax tokenizer runs once per parsed region per call; the settlement scan never invokes tokenizers.
  • Parser work counters stay linear for one large item, a nested list inside it, and fenced blocks in one ordered item. List snapshot copies, including released projections, are counted separately.
  • parser.perf.test.ts tracked whole-prefix numbers are unchanged.

Scope

  • One parser-ownership defect is restored.
  • Full and incremental parsing share the same ownership rules.
  • Unrelated renderer, API, and visual changes are excluded.
  • Public text and artifacts contain no internal context.

Testing

  • vitest run packages/core/src/Markdown packages/core/src/Outline packages/core/src/CodeBlock — 25 files, 866 tests.
  • tsc --project packages/core/tsconfig.json --noEmit.
  • eslint . — 0 errors.
  • pnpm check:repo, including check:knowledge.

Stack

Base: main · Next: #6657 · Each PR is intentionally one commit and one primary intent.

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 5, 2026 11:59pm UTC

Request Review

@ernestt ernestt mentioned this pull request Sep 26, 2026
4 tasks done
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 26, 2026
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 26, 2026
@astracat-bot

astracat-bot Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Oct 6, 2026, 12:22 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 26, 2026
github-actions Bot added a commit that referenced this pull request Sep 26, 2026
@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox are not both ready on the exact-head Vercel preview.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

15 of 424 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
SideNav Resizable in AppShell probe dark 3,208
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858

Generated by PR Enrichment workflow | View full report

@ernestt

ernestt commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

@cixzhang — I’d appreciate your feedback on this draft.

Focus: Authors can place a blank line before a fenced code block inside a list item without the fence escaping the item or rendering as stray text.

This is PR 1/20 in the linked Markdown stack. It is intentionally one commit and one primary intent; the description includes matched before/after screenshots and previous/next links, so you can review just this PR’s delta.

@humbertovirtudes humbertovirtudes left a comment

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.

findSettledBoundary() now holds the boundary before an entire active list, so a streamed loose list never advances the settled prefix until the list ends. parseMarkdownIncremental() consequently reparses the whole growing list on every update, turning character streaming into quadratic work and defeating the tail-bounded cache contract. Please keep only the current item or open fence mutable, allow completed list segments to settle through the existing merge path, and add a two-size work-counter regression including the claimed CRLF case.

@ernestt
ernestt force-pushed the markdown-upgrade/01-loose-fences branch from 5ea3d97 to d6cbc28 Compare October 5, 2026 23:50
@ernestt ernestt closed this Oct 9, 2026
@github-actions
github-actions Bot deleted the markdown-upgrade/01-loose-fences branch October 10, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — d6cbc285 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants