Skip to content

fix(Markdown): preserve semantic fence spacing - #6674

Closed
ernestt wants to merge 1 commit into
markdown-upgrade/18-katex-lazy-stylesfrom
markdown-upgrade/19-semantic-fence-spacing
Closed

ernestt wants to merge 1 commit into
markdown-upgrade/18-katex-lazy-stylesfrom
markdown-upgrade/19-semantic-fence-spacing

Conversation

@ernestt

@ernestt ernestt commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Successful semantic-fence renderers keep the same Markdown block rhythm, width, alignment, edge behavior, and theme target as their CodeBlock fallback.

Problem and solution fit

The success path returned extension output directly while the loading/failure path remained inside markdown-codeblock, so adjacent renderers could collapse together and configured block geometry disappeared after loading.

Expected behavior and authority

The Markdown component contract's extension-theme and block-geometry requirements. Pinned source.

Smallest restoration

Separate fallback content from wrapper props and retain the standard Markdown code-block wrapper for both successful extension output and fallback.

Evidence

Real-browser evidence

Semantic-fence spacing before and after

Measured adjacent ANSI→Shiki gap: 0px before → 16px after; successful renderers retain the same wrapper as fallback.

  • Representative unchanged paths are covered by focused regression tests.
  • Mutation-sensitive proof is included with the implementation.

Scope

  • One defect is restored.
  • Separable tagalongs were removed or split into adjacent stack entries.
  • No unrelated API or visual change is hidden under the bug-fix label.
  • Public text and artifacts contain no internal context.

Testing

  • Focused: Semantic-fence wrapper/spacing tests plus matched real-browser adjacent-renderer measurements.
  • 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: #6673 · Next: #6675 · Each PR is intentionally one commit and one primary intent.

@ernestt ernestt mentioned this pull request Sep 26, 2026
3 tasks done
@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:45pm 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
@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 5, 2026, 11:50 PM UTC

@ernestt

ernestt commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

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

Focus: Successful semantic-fence renderers keep the same Markdown block rhythm, width, alignment, edge behavior, and theme target as their CodeBlock fallback.

This is PR 19/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.

The implementation now shares the correct outer wrapper, but the regression test does not prove the spacing change. Removing the spacing and first or last margin styles still leaves the class and density assertions green. Please assert the wrapper’s actual StyleX margin declarations for default and compact density, including first and last block suppression, using the existing declaration helper.

@ernestt
ernestt added this pull request to stack #6700 September 28, 2026 18:03
github-actions Bot added a commit that referenced this pull request Sep 28, 2026
@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 719 -
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 of 422 shot(s) changed. View the report

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
Markdown Default probe dark 29,661
Markdown Default probe light 29,652
Markdown — Default — probe dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Markdown — Default — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | View full report

@ernestt
ernestt force-pushed the markdown-upgrade/19-semantic-fence-spacing branch from be885f6 to d1e0890 Compare October 5, 2026 23:30
@github-actions github-actions Bot added 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 labels Oct 5, 2026
Summary:
Keep Markdown’s existing code-block wrapper, density rhythm, max-width, alignment, and first/last edge handling when a semantic fence renderer replaces the ordinary CodeBlock. Keep the fallback inside that same wrapper so loading and failure do not shift layout.

Test Plan:
- pnpm exec vitest run packages/core/src/Markdown/plugins/semanticFence.test.tsx packages/core/src/Markdown/ansi/ansi.test.tsx packages/core/src/Markdown/mermaid/mermaid.test.tsx packages/core/src/Markdown/shiki/shiki.test.tsx --root .
- pnpm --filter @astryxdesign/core typecheck
@ernestt
ernestt force-pushed the markdown-upgrade/19-semantic-fence-spacing branch from d1e0890 to 7f3eeae Compare October 5, 2026 23:35
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 5, 2026
@ernestt ernestt closed this Oct 9, 2026
@github-actions
github-actions Bot deleted the markdown-upgrade/19-semantic-fence-spacing branch October 10, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 7f3eeaee 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants