Skip to content

fix(markdown): preserve links, trailing breaks and table images - #5152

Merged
zbeyens merged 3 commits into
nextfrom
codex/markdown-regression
Oct 8, 2026
Merged

zbeyens merged 3 commits into
nextfrom
codex/markdown-regression

Conversation

@natamox

@natamox natamox commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator
  • Auto release

Plan: Markdown regression fixes

Why

Markdown export can fail for bare URLs in headings and sized images in table cells, or lose trailing breaks in paragraphs and list items. Fix the shared conversion rules so these documents survive export and import.

Scope

  • Correct HTML content classification and reuse paragraph encoding for list items, including CRLF and trailing breaks.
  • Preserve registered childless block tags in table cells, with a regression test for image width.
  • Update the existing package changeset, the English and Chinese Markdown docs and generated registry output. HTML/DOCX conversion and preview UI are unchanged.
  • Remove two www serializer tests that pinned the old trailing-break output. That output read back with a lost break and a stray backslash; commonmarkSurface.slow.ts and paragraphBreaks.spec.ts now assert the round trip for the same inputs.

Review guide

Start with markdownIntrinsics.ts (encodeMarkdownParagraph), then listToMdastTree.ts, which now calls it, then mdastContent.ts. The table-cell change is the pair markdownLine.ts (writer) and markdownTags.ts (reader). Everything under apps/www/public/r and apps/www/src/__registry__ is generated.

Tradeoffs

Keep line-break handling in the paragraph encoder and tag handling in the existing converter. Avoid image-specific serialization and exported-string post-processing. A shorter output that writes only the last trailing break as HTML would delete the conversion loop but change every single-break snapshot, so it stays out of this fix.

Blast Radius

The shared Markdown converter is affected. No public API or editor schema changes. Tags with child content are outside the new table behavior.

Verification

  • Markdown partition: 275 passed; list partition: 49 passed; slow CommonMark cases: 28 passed. Markdown typecheck and scoped lint passed.
  • Round-trip probe at c70bacbd4a and at this head: at base, a<br/><br/> reads back as a\ plus one break, a list item drops its trailing break and a heading autolink throws; at this head all three round-trip.
  • CI: the two www serializeMarkdown failures were this PR's and are fixed. The other red steps fail the same way on next (c70bacbd4a CI run 37771713058 and Plite CI run 37763729690 at 592ec28578): the main-to-next sync tooling test, core-audits (rg missing), entrypoint-graph, www (plate CLI missing) and six Plite Chromium cases (getFlatTreeParentElement is not defined). The EditorStatic reuse oracle timed out on CI and passed 3 of 3 locally in 1.4 s.

Full repository checks, production builds and the browser engine matrix were not run.

@natamox
natamox requested a review from a team October 8, 2026 14:45
@codesandbox

codesandbox Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web Editor • VS Code • Insiders

Open Preview

@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1efe622

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 1 package
Name Type
platejs Major

Click here to learn what changesets are, and how to add one.

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

The two www serializeMarkdown tests pinned the old trailing-break output, which
read back with a lost break and a stray backslash. commonmarkSurface.slow.ts
and paragraphBreaks.spec.ts already assert the round trip for the same inputs.
The Chinese Markdown page now matches the English table-cell rule.
# Conflicts:
#	apps/www/src/__registry__/generation.json
#	apps/www/src/__registry__/index.tsx
#	apps/www/src/__registry__/overlays/manifest.json
#	apps/www/src/__registry__/registry-metadata.json
#	docs/editor-behavior/current-evidence.md
@zbeyens
zbeyens merged commit 795d0bc into next Oct 8, 2026
3 checks passed
@zbeyens
zbeyens deleted the codex/markdown-regression branch October 8, 2026 22:42
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.

2 participants