Skip to content

feat(Markdown): add prepared documents - #6659

Closed
ernestt wants to merge 1 commit into
markdown-upgrade/03-heading-identityfrom
markdown-upgrade/04-prepared-documents
Closed

ernestt wants to merge 1 commit into
markdown-upgrade/03-heading-identityfrom
markdown-upgrade/04-prepared-documents

Conversation

@ernestt

@ernestt ernestt commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

User need

Hosts that render the same parsed Markdown in multiple places can prepare it once and reuse the exact canonical document and Outline projection.

Problem and solution fit

String-only rendering repeated parsing and transform work and left hosts to coordinate independently derived Outline data. An opaque prepared value makes that reuse explicit while preventing incompatible inline or streaming combinations.

Current specification

The prepared-document requirement in the Markdown component contract and AST-036's canonical document model. Pinned source.

Public delta and caller burden

Export prepareMarkdownDocument() and a block-only document input, preserve opaque validation, and let Outline consume the readonly projected items without copying.

Design and alternatives

The capability is explicit and opt-in where it changes syntax, rendering, or package weight. Existing defaults and replacement seams remain compatible; broader alternatives stay outside this PR.

Evidence

Functional evidence

This change is intentionally nonvisual; a pixel comparison would be misleading.

  • Tests assert one parse/transform pass, opaque-value validation, exact prepared rendering, readonly Outline reuse, and rejected inline/streaming combinations.

Focused behavior and compatibility coverage ships with the implementation.

Scope

  • One capability is added.
  • Unrelated fixes and policy changes were split into adjacent stack entries.
  • Consumer docs and focused tests ship with the feature.
  • Public text and artifacts contain no internal context.

Testing

  • Focused: Prepared-document public types, runtime validation, plugin reuse, Markdown rendering, SSR, and Outline tests.
  • Stack head: pnpm exec vitest run packages/core/src/Markdown packages/core/src/CodeBlock — 37 files, 760 tests.
  • Stack head: pnpm --filter @astryxdesign/core typecheck.
  • Repository checks: pnpm check:repo.

Stack

Previous: #6658 · Next: #6660 · 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 Sep 26, 2026 3:09pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. 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) Sep 28, 2026, 6:55 PM UTC

@ernestt

ernestt commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

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

Focus: Hosts that render the same parsed Markdown in multiple places can prepare it once and reuse the exact canonical document and Outline projection.

This is PR 4/20 in the linked Markdown stack. It is intentionally one commit and one primary intent; the description includes focused functional evidence 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.

prepareMarkdownDocument() promises an immutable snapshot, but the public root remains mutable while only the outer document and outline are frozen. A consumer can mutate nested nodes after heading projection, causing rendered content to diverge from document.outline and the retained heading-ID map. Please deep-freeze the complete root at the preparation boundary and add a nested-mutation regression covering Markdown and Outline parity.

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 27, 2026
@ernestt
ernestt added this pull request to stack #6700 September 28, 2026 18:02
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

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

Modified Components

Outline (@astryxdesign/core)
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 717 -
Complexity N/A High (28) -

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

2 added · 2 removed.


Generated by PR Enrichment workflow | View full report

@ernestt ernestt closed this Oct 9, 2026
@github-actions
github-actions Bot deleted the markdown-upgrade/04-prepared-documents branch October 10, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 5ff21757 Deployed Sep 26, 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:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants