Repository navigation
[lexical-markdown] Bug Fix: Preserve literal text and escaped link brackets in Markdown round trips - #9481
Merged
Conversation
…version
## Description
Text containing angle brackets, character references or link-shaped punctuation
could acquire Markdown syntax during conversion. Preserve literal text across
styled runs, inline wrappers and selections, and decode references and escapes
once. Classify custom exporter output before coalescing ordinary code runs so
custom syntax is neither absorbed nor emitted twice.
Default HTML-looking text now exports escaped. Angle autolinks import as
LinkNodes and export in canonical link form. Explicit custom transformer output
remains intentional Markdown. Preserve source hard-break markers separately
from text, and keep entity-produced whitespace from becoming structural syntax.
Use the named-reference decoder's platform exports: a DOM decoder for browsers,
and a DOM-free table for Node and workers. Keep that dependency external in npm
builds. Document the compatibility behavior and transformer ownership contract.
## Test plan
### Before
`node_modules/.bin/vitest run --project unit packages/lexical-markdown/src/__tests__/unit/MarkdownTextEscaping.test.ts`
```text
Test Files 1 failed (1)
Tests 60 failed | 19 passed (79)
```
### After
`node_modules/.bin/vitest run --project unit packages/lexical-markdown/src/__tests__/unit packages/lexical-playground/__tests__/unit/MarkdownTransformers.test.ts --project scripts-unit scripts/__tests__/unit/treeShakingSource.test.ts`
```text
Test Files 11 passed (11)
Tests 1167 passed (1167)
```
Browser tests used the repository Vitest config with a temporary Playwright
launch override for the installed `/usr/bin/chromium` executable:
`node_modules/.bin/vitest run --config /tmp/markdown-browser.config.mts --project browser packages/lexical-markdown/src/__tests__/browser/MarkdownTextEscaping.test.ts packages/lexical-markdown/src/__tests__/browser/MarkdownShortcuts.test.ts`
```text
Test Files 2 passed (2)
Tests 25 passed (25)
```
Built ESM package smoke test in Node without `document`:
```text
Built package: 6 named/numeric reference round trips passed in Node without document.
```
Root, test and scripts TypeScript checks, package build, changed-file ESLint,
Prettier and frozen offline lockfile validation passed. Repository ESLint passes
when the pre-existing ignored `playwright.local.config.mjs` (missing a license
header) is excluded. Firefox and WebKit were not exercised.
## Description Serialize literal runs using their emitted neighbours, including unchanged delegated custom-exporter callback results, without traversing custom exporters twice. Keep authored Markdown strings opaque and use actual code fences for formatting flanking decisions. Cover generated three- and four-run transitions, wrappers, selections and exporter ownership. Decode named references using a DOM-free character table so Worker imports and Trusted Types environments work consistently. The table adds approximately 12.2 kB gzip to the browser bundle compared with the DOM decoder; Node bundle size is effectively unchanged. Represent preserved hard breaks as LineBreakNodes rather than paragraph boundary metadata. Copy their source marker and exercise deletion, splitting, joining, JSON and history so removed boundaries cannot reappear. Preserve literal backslashes at block boundaries and retain established whitespace normalization. ## Test plan ### Before Independent review reproduced Worker and Trusted Types failures, overlapping-format delimiter fusion, literal-backslash deletion and stale paragraph hard-break state. The final additional boundary regressions reported: 10 failed | 2 passed | 130 skipped. ### After Full Markdown, playground transformer and source tree-shaking checks: 11 passed files; 1195 passed tests. Chromium Markdown conversion and shortcut checks: 2 passed files; 26 passed tests. Development package build and root/test/scripts TypeScript checks pass. Actual Chromium Worker import and Trusted Types CSP decoding probes pass. A 2304-case independent boundary corpus fixes 495 cases with no new failures. Frozen offline lockfile policy validation passes.
## Description Memoize semantic child fragments throughout each block export, including selected headings, multiple declined inspectors and overlapping subtrees. Keep the fragment tree separate from contextual delimiter emission so cached inspection does not freeze formatting or duplicate descendant transformer calls. Recognize repeated whole callback concatenations as delegated ordinary content. Emit character references at Unicode symbol boundaries conservatively so formatting survives differences in parser punctuation and UTF-16 handling. Preserve the CommonMark punctuation definition while covering both external parsing and repeated Lexical conversion. ## Test plan ### Before Partial heading selection and two declined nested inspectors: 3 failed. Full block inspection: 1 failed, 1 passed. Overlapping subtree inspection: 2 failed. Repeated callback concatenation: 1 failed. Astral punctuation controls: 2 failed, 5 passed; adding repeated-import controls also exposed BMP-symbol formatting loss. ### After Full Markdown, playground transformer and source tree-shaking checks: 11 passed files; 1210 passed tests. Focused final inspection, callback and symbol controls: 15 passed. Root TypeScript check passes. Generated three- and four-run sequences include symbols, wrapper transitions and code boundaries; symbol cases include repeated import/export. Source lint and formatting checks pass.
## Description Read completed emphasis before a later disjoint code span, while retaining code precedence for overlapping ranges. This prevents code extraction from separating surrounding emphasis delimiters across TextNodes. When only the first backtick of a physical run is escaped, allow the remaining suffix to open a code span. Keep the complete physical run for closing-fence matching, where backslashes are literal. Include the escape backslash in ASCII punctuation used for delimiter flanking. ## Test plan ### Before Three generated mixed-format scenarios lost emphasis on repeated conversion. An escaped backtick immediately before a code fence was not recognized as literal text followed by code. Code followed by an escaped backtick could lose outer formatting because backslash was omitted from punctuation classification. Each new regression group failed before its correction. ### After Repeated-conversion corpus: 3072 cases pass, versus 1421 failures on original main; no new failures. Focused repeated conversion controls cover disjoint formats, both code/escaped-text orders, zero through three backslashes, one through three literal ticks, variable fences, code content ending in backslashes and three conversion rounds. Existing single-line CODE block extension is retained; inline code controls use unambiguous paragraph context. Full Markdown, playground transformer and source tree-shaking checks: 11 passed files; 1214 passed tests.
## Description Replace the eight added unchecked node traversal type arguments with base return types and concrete guards. Keep the Markdown conformance tests compatible with removal of deprecated traversal generics while preserving the reviewed implementation. ## Test plan ### Before The conformance tests introduced eight unchecked getFirstChildOrThrow/getChildren type arguments. ### After The compatibility pass found no remaining added traversal generics. Before the executor disconnected, 15 focused tests and the test TypeScript check passed, and independent read-only review found no issue with the guards. Packaging resumes from those validated edits without implementation changes or another broad test run.
## Description Keep named-reference decoding platform-specific: leave decode-named-character-reference external in npm builds so browsers select its native implementation and Node or explicitly configured Worker builds select the separate table. Prefer native Element.setHTML where available to support Trusted Types without creating a policy. Use the active editor's document, and document the older-browser strict-CSP limitation and explicit DOM-free build option. Select the decoder's browser condition in www builds through a gated resolver that leaves unrelated dependencies under their existing resolver. Add a regression checking native selection, table exclusion and continued semver bundling. Preserve one-pass escaping and numeric/named reference semantics. ## Test plan ### Before The default browser implementation bundled the complete table. The retained table-path production benchmark now reports: ``` "label": "browser-worker", "published": true, "hasTable": true, "minified_bytes": 67244, "gzip_bytes": 24621 ``` ### After ``` vitest run --project unit packages/lexical-markdown/src/__tests__/unit/MarkdownTextEscaping.test.ts Test Files 1 passed (1) Tests 165 passed (165) vitest run --project browser packages/lexical-markdown/src/__tests__/browser/MarkdownTextEscaping.test.ts Test Files 1 passed (1) Tests 9 passed (9) vitest run --project scripts-unit scripts/__tests__/unit/namedReferenceBrowserResolver.test.ts Test Files 1 passed (1) Tests 1 passed (1) "label": "browser-native", "published": true, "hasTable": false, "minified_bytes": 31592, "gzip_bytes": 12460 ``` The browser command used Chromium with the saved local provider configuration. Native decoding matched all 2125 entity names. The production package build and root/test/scripts TypeScript checks exit 0. Independent checks also passed the full 859-test Markdown unit directory, unknown/partial-name controls, iframe document switching, and public production consumer fixtures. Strict Trusted Types controls confirm native setHTML success without a policy, blocked legacy HTML sinks, and the explicit Worker-condition fallback without DOM or a permissive policy. Firefox, WebKit, packed npm installation and a complete www build were not exercised; the gated www resolver has a direct Rollup regression.
## Description Configure named-reference decoding through MarkdownExtension for Markdown import, detached-node generation and link shortcuts. The native decoder remains the default. SSRMarkdownExtension is an explicit separate import that supplies the full table for servers, Workers and browsers that need a DOM-free implementation. Applications can override the decoder through configExtension without global settings or new conversion parameters. Keep backslash and numeric-reference handling in Lexical's single pass, and never rescan a decoder's output as syntax. Legacy editors remain usable: native decoding works when a document exists, and DOM-free editors without configuration retain named references as text. Editor configuration is independent across nested editors and is not part of document serialization. Remove decoder-specific package resolution and test aliases now that the full table has an explicit module boundary. Register transformer node dependencies and shortcuts separately. Document native Trusted Types requirements and the explicit SSR/custom alternatives. ## Test plan ### Before Named-reference implementations were selected by package export conditions. Editor configuration could not choose a decoder, and browser-targeted Worker consumers needed a separate build condition. The retained production module benchmark for that browser implementation was 31592 bytes minified / 12460 gzip. It did not expose an editor-scoped decoder hook. ### After ``` vitest run --project unit packages/lexical-markdown/src/__tests__/unit Test Files 10 passed (10) Tests 869 passed (869) vitest run --project browser packages/lexical-markdown/src/__tests__/browser Test Files 2 passed (2) Tests 29 passed (29) vitest run --project scripts-unit scripts/__tests__/unit/markdownDecoderBundles.test.ts Test Files 1 passed (1) Tests 2 passed (2) vitest run --project scripts-unit scripts/__tests__/unit/treeShakingSource.test.ts -t @lexical/markdown Tests 12 passed | 337 skipped (349) node scripts/check-flow-types.mjs Found 0 errors ``` Browser tests used Chromium with the local executable provider. Root/test/scripts TypeScript checks, production package build, lint, formatting and frozen offline lockfile policy verification passed. The published-build tree-shaking check also passed against the current production artifacts using a scoped runner without release packaging setup. Production module benchmark with Lexical siblings externalized: default native 31791 bytes minified / 12524 gzip; root plus explicit SSR 67762 / 24812. Default artifact graph and output contain no entity table. Independent published consumers with ordinary package resolution verified direct Node and a real Web Worker, all 2125 names, one-pass controls, root/SSR extension identity, nested editor isolation, and strict Trusted Types with no policy. Native setHTML succeeds; older native HTML sinks fail under strict Trusted Types while explicitly configured SSR and custom decoders succeed. Firefox, WebKit, a packed npm installation and a complete www build were not exercised. The standard integration setup requires release packaging; the scoped published-artifact check avoids that separate packaging step.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…Markdown lockfile ## Description Merge current main, including the happy-dom update, without changing Markdown behavior. Regenerate the lockfile with repository-pinned pnpm 11.24.0 so the Markdown test parser resolves to the existing mdast-util-from-markdown 2.1.0 package and snapshot. The previous importer referenced 2.0.3, which had no package or snapshot entry and prevented CI from installing dependencies. Retain pnpm's generated executable-metadata normalization without changing unrelated dependency versions. ## Test plan ### Before Node 24 / pnpm 11.24.0 CI failed during the frozen install before tests: ``` [ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY] Broken lockfile: no entry for '[email protected]([email protected])' in pnpm-lock.yaml ``` ### After In a separate checkout initially without node_modules, using a new package store and lifecycle scripts enabled: ``` CI=true corepack pnpm install --frozen-lockfile --store-dir /workspace/lexical-ci-fresh-store --cache-dir /workspace/lexical-pnpm-cache . prepare$ husky . prepare: Done packages/lexical-devtools postinstall$ wxt prepare packages/lexical-devtools postinstall: Done Done in 24.2s using pnpm v11.24.0 ``` Node v24.19.0. Dependency metadata was cached by regeneration; no installed packages or package-store contents were reused for this clean install. Local post-install checks and the new exact-head CI matrix will run after this install repair is pushed.
lexical
@lexical/a11y
@lexical/clipboard
@lexical/code
@lexical/code-core
@lexical/code-prism
@lexical/code-shiki
@lexical/compiler
@lexical/devtools-core
@lexical/dragon
@lexical/eslint-plugin
@lexical/extension
@lexical/fast-check
@lexical/file
@lexical/hashtag
@lexical/headless
@lexical/history
@lexical/html
@lexical/internal
@lexical/link
@lexical/list
@lexical/mark
@lexical/markdown
@lexical/mdast
@lexical/offset
@lexical/overflow
@lexical/plain-text
@lexical/react
@lexical/rich-text
@lexical/selection
@lexical/table
@lexical/tailwind
@lexical/text
@lexical/utils
@lexical/yjs
commit: |
…erve authored syntax ## Description Retain the established Markdown APIs and legacy literal treatment of named references. Remove the new named-reference decoder, editor extensions, SSR entry, associated configuration and runtime dependency. Decimal and hexadecimal numeric references and backslash escapes are still read in one pass; decoded text cannot become another reference. Export protects reference-looking literal text for subsequent Markdown rendering. Remove repetition inference from custom exporter callback delegation. A transformer that returns an authored string owns that syntax, even when the string happens to repeat a callback preview. Previously an authored code span containing two internal backticks could be rewritten to a different code span and lose those characters. Keep unchanged-result and whole-concatenation delegation, plus ordinary import/export, selection, formatting and hard-break conformance fixes. ## Test plan ### Before The branch included new decoder and extension APIs. CI unit checks also failed the package audit because the additional SSR export conflicted with single-entry package metadata. A custom exporter that previewed `a` as inline code and then returned the authored code span '`a``a`' was serialized as '`aa`', losing its internal backticks. ### After Focused clean-checkout verification uses Node24, repository-pinned pnpm11.24, and Markdown parser2.1. The package audit passes after restoring the established single-entry package shape. Browser conformance checks pass: ``` Test Files 2 passed (2) Tests 25 passed (25) ``` The focused suite and package audits passed in the clean checkout with bounded workers: ``` Test Files 10 passed (10) Tests 3435 passed (3435) ``` Frozen install with lifecycle scripts succeeds. Independent Node, Chromium and actual Web Worker probes agree across numeric bounds, escape ordering, named-literal handling, styled-run conversion, inline code and partial selection controls; clean external Markdown2.1 parsing preserves the visible text without new HTML/link/image nodes. The runtime graph contains no entity-table dependency. Full exact-head CI will continue after pushing.
…wn syntax ## Description Markdown export escapes harmless punctuation and emits unnecessary references around formatting changes. Check the emitted syntax before retaining literal escapes, and repair actual emphasis and strikethrough delimiter boundaries. Keep real links and opaque transformer output intact, including document-wide reference definitions. Use CommonMark Unicode punctuation rules consistently when importing formatting. ## Test plan ### Before Exporting bold text around an inline code span produced: ```markdown **&meta#97;`b`&meta#99;** ``` Plain text exports included `AT\&T`, `a \< b`, and `\[label\]`. ### After The corresponding exports are `**a`b`c**`, `AT&T`, `a < b`, and `[label]`. All 15 changed existing output expectations preserve full GFM text, formatting, link and block semantics. ``` vitest run --project unit --project scripts-unit packages/lexical-markdown scripts/__tests__/unit/treeShakingSource.test.ts --maxWorkers=1 Test Files 10 passed (10) Tests 1263 passed (1263) vitest run --project browser packages/lexical-markdown/src/__tests__/browser packages/lexical-playground/src/__tests__/browser/MarkdownInlineShortcuts.test.ts Test Files 3 passed (3) Tests 43 passed (43) ``` Chromium used the system browser. Firefox, WebKit, packed npm and www builds were not rerun locally for this follow-up. Source and test TypeScript checks, ESLint and Prettier pass.
## Description The standalone style example imports a callback type from a separate floating Zag dependency. Fresh installs resolve Zag 1.47 there while Ark's combobox uses 1.45, making the callback require a modifiers field that Ark does not provide. Use Ark's exported SelectionDetails type, as the existing input-change callback already does, and remove the unused direct Zag dependency. ## Test plan ### Before A fresh standalone install through the integration harness reproduces: ``` src/plugins/StyleViewPlugin.tsx(654,5): error TS2322 Property 'modifiers' is missing in type '...@[email protected]' but required in type '...@[email protected]'. Test Files 1 failed (1) ``` ### After ``` vitest run --project integration scripts/__tests__/integration/prepare-release.test.mjs -t 'examples/node-state-style' Test Files 1 passed (1) Tests 2 passed | 98 skipped (100) ``` The first passing run built and packed all release packages from scratch. A second passing run repeated the example's clean install and build after reproducing the original failure with the same release tarballs. Both use Node 24 and the repository-pinned pnpm 11.24.0. Changed-file ESLint and Prettier checks pass. The complete integration matrix remains a CI check.
…ferences focused ## Description Default export escapes literal ampersands, angle brackets and link brackets without changing the existing exporter flow. Import reads backslash escapes and decimal/hexadecimal references once, honors escaped link brackets, and reuses the existing code-span scanner so code-formatted link labels retain their backslashes. Keep legacy newline-preserving source output and custom transformer behavior unchanged. No new public API or dependencies. Limit the change to these text round trips and sync current main, which already contains the standalone example dependency correction. ## Test plan ### Before The focused suite with main 8a573d1 source: ``` vitest run --config /tmp/markdown-main-controls.config.mts --project unit packages/lexical-markdown/src/__tests__/unit/MarkdownEscaping.test.ts --maxWorkers=1 Test Files 1 failed (1) Tests 23 failed | 16 passed (39) ``` ### After ``` vitest run --project unit packages/lexical-markdown --maxWorkers=1 Test Files 9 passed (9) Tests 733 passed (733) vitest run --project browser packages/lexical-markdown/src/__tests__/browser packages/lexical-playground/src/__tests__/browser/MarkdownInlineShortcuts.test.ts Test Files 2 passed (2) Tests 37 passed (37) vitest run --project scripts-unit scripts/__tests__/unit/treeShakingSource.test.ts scripts/__tests__/unit/build.test.ts --maxWorkers=1 Test Files 2 passed (2) Tests 2923 passed (2923) ``` Chromium used the system browser. Source and test TypeScript, changed-file ESLint and Prettier pass. GFM controls check literal text at every split point, real links/code and custom-transformer compatibility against main. Firefox, WebKit, packed integration and www builds were not rerun locally for this cut.
…ncing ## Description A link containing code-formatted `[` followed by plain `]`, or the reverse, loses its link coverage or code formatting when imported from the escaped export. Ignore brackets inside the code spans already found by the existing scanner, as well as escaped plain brackets, while preserving source offsets. ## Test plan ### Before The two regression tests pass against main 8a573d1 and fail at e5e151d: ``` vitest run --project unit packages/lexical-markdown/src/__tests__/unit/MarkdownEscaping.test.ts -t 'mixed code/plain brackets' --maxWorkers=1 Test Files 1 failed (1) Tests 2 failed | 39 skipped (41) ``` ### After ``` vitest run --project unit packages/lexical-markdown --maxWorkers=1 Test Files 9 passed (9) Tests 735 passed (735) vitest run --project browser packages/lexical-markdown/src/__tests__/browser packages/lexical-playground/src/__tests__/browser/MarkdownInlineShortcuts.test.ts Test Files 2 passed (2) Tests 37 passed (37) ``` Chromium used the system browser. Changed-file ESLint and Prettier pass. Firefox, WebKit and packed integration were not rerun locally for this fix.
…link text
## Description
Escaped link text can absorb following code or custom matches into one candidate, bypassing their import transformers. Keep the existing label boundaries and explicitly reject escaped opening or closing brackets. Other transformers receive the following text as before.
## Test plan
### Before
`node_modules/.bin/vitest run --project unit packages/lexical-markdown/src/__tests__/unit/MarkdownEscaping.test.ts -t "runs import transformers after" --maxWorkers=1`
```
Test Files 1 failed (1)
Tests 2 failed | 84 skipped (86)
```
Both code/custom-transformer controls pass against main.
### After
`node_modules/.bin/vitest run --project unit packages/lexical-markdown --maxWorkers=1`
```
Test Files 9 passed (9)
Tests 780 passed (780)
```
Focused Chromium Markdown and playground shortcut checks:
```
Test Files 2 passed (2)
Tests 37 passed (37)
```
Source/test TypeScript, ESLint, Prettier and git diff --check passed. Firefox and WebKit were not run locally.
etrepum
marked this pull request as ready for review
October 28, 2026 14:39
etrepum
requested review from
acywatson,
ivailop7,
potatowagon and
zurfyx
as code owners
October 28, 2026 14:39
etrepum
enabled auto-merge
October 28, 2026 14:39
etrepum
disabled auto-merge
October 28, 2026 14:41
etrepum
enabled auto-merge
October 28, 2026 14:53
zurfyx
approved these changes
Oct 28, 2026
zurfyx
added a commit
that referenced
this pull request
Oct 28, 2026
## Description #9481 merged after the changesets in this PR were written. This adds its `[fix]` entry, with `Verify:` since Markdown export output changes. ## Test plan ### After ``` $ pnpm run check-changesets Changeset check passed: 56 pending changeset(s) valid. ```
Merged
AlessioGr
added a commit
to payloadcms/payload
that referenced
this pull request
Oct 28, 2026
_Written with AI_ Upgrades lexical from `0.52.0` to `0.53.0`. ## Breaking changes Rich-text data keeps its existing format. No database migration is needed. Payload's built-in features have been updated, but your own TypeScript code or custom features may need changes: - **Node type arguments:** `getParent<T>()`, `getParentOrThrow<T>()`, `getChildren<T>()`, `getFirstChild<T>()`, `getNextSibling<T>()`, `$getNodeByKey<T>()` and the rest of that family no longer accept a type argument. Remove `<T>` and narrow the result with a node guard such as `$isListItemNode`. Runtime behavior is unchanged. - **Removed extensions:** `LinkImportExtension`, `ListImportExtension`, `RichTextImportExtension` and `HorizontalRuleImportExtension` (deprecated in 0.52) are no longer exported from `@payloadcms/richtext-lexical/lexical/link`, `/list`, `/rich-text` and `/html`. Use `LinkExtension`, `ListExtension` and `RichTextExtension`; for horizontal rules, use `HorizontalRuleExtension` from `@lexical/extension`. - **Markdown export:** `convertLexicalToMarkdown` escapes literal brackets and HTML-like text, for example `[note]` becomes `[note]`, so it is not parsed back as a link or HTML. `convertMarkdownToLexical` restores the original text. ## Breaking changes and Payload migrations Reviewed [0.53.0](https://github.com/meta/lexical/releases/tag/v0.53.0) and the `CHANGELOG.md` now shipped in the `lexical` package, including its behavior changes. **Yes** means Payload code needed adaptation; **No** means no Payload migration was required. | Breaking change | Required migration in Payload | Changes made | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | [Unchecked node type arguments are removed](meta/lexical#9479) from traversal and key lookup methods. | Yes | `TableCellResizerPlugin` called `tableRow.getChildren<TableCellNode>()`. It now uses `.filter($isTableCellNode)`, matching the upstream playground. | | [Extensions deprecated in 0.52 are removed](meta/lexical#9316). | No | Payload does not use them. They disappear from the `export *` proxies listed above. | | [`ElementNode.reconcileObservedMutation` restores the committed children's DOM](meta/lexical#9329) (`@internal`). | No | No Payload call sites. | | [`@lexical/mdast` stores table column alignment as cell paragraph format](meta/lexical#9478). | No | Payload does not use `@lexical/mdast`. | | Behavior: [Markdown export escapes literal text](meta/lexical#9481). | No | Documented in the migration guide. MDX round-trip int tests pass unchanged. | | Behavior: [a read-only `ContentEditable` without an accessible name no longer renders `role="textbox"`](meta/lexical#9270). | No | Payload passes the field label as `aria-label`, so labeled read-only editors keep the role. | | Behavior: [`ClickableLinkPlugin` opens new tabs without `window.opener`](meta/lexical#9303), and [nested editors handle their own link clicks](meta/lexical#9360). | No | The link feature uses `ClickableLinkPlugin` and gets the reverse-tabnabbing fix automatically. | Package entry points of every proxied package were compared against 0.52.0. The only addition is the experimental `@lexical/html/BlockIdHTMLExtension` subpath. Payload only re-exports the `@lexical/html` root, so no proxy exports need adding or removing. ## Previous Lexical upgrades - [#18397](#18397) — 0.50.0 → 0.52.0 - [#18149](#18149) — 0.48.0 → 0.50.0 - [#17554](#17554) — 0.45.0 → 0.48.0
This was referenced Oct 29, 2026
etrepum
pushed a commit
to haripetrov-stack/lexical
that referenced
this pull request
Oct 30, 2026
…ctuation, and read astral characters whole ## Description With Unicode punctuation (and the backslash) counted as punctuation on import, the exporter's intraword markers no longer round-trip when the formatted text starts or ends with punctuation next to a letter: plain `a` then bold `*` exported as `a**\***`, which CommonMark (and now the importer) reads as literal asterisks. Seven MarkdownEscaping tests from meta#9481 failed after merging main. The exporter now writes the letter beside such a marker as a numeric character reference (`&meta#97;**\***`), whose `&` or `;` is punctuation, so the marker flanks. Flanking checks in import and the typing shortcuts also read the characters around a marker by code point, so an emoji (category So) outside the Basic Multilingual Plane counts as punctuation. ## Changeset `.changeset/markdown-unicode-punctuation-flanking.md` ## Test plan `./node_modules/.bin/vitest run --project unit packages/lexical-markdown` ### Before ``` Test Files 1 failed | 8 passed (9) Tests 7 failed | 844 passed (851) ``` (`MarkdownEscaping.test.ts > preserves existing formatted markers after plain text` and `preserves formatted backslashes next to plain text`, e.g. `expected 'a*****' to be 'a*'`.) ### After ``` Test Files 9 passed (9) Tests 860 passed (860) ``` Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Protect literal text from becoming HTML, numeric character references or links when exported as Markdown and parsed again.
<and&characters, including ambiguous characters at text-node boundaries. Use numeric references for these characters to preserve adjacent emphasis formatting. Ordinary text such asAT&Tanda < bstays unchanged.Named references retain their existing behavior. Code, custom transformer output and
shouldPreserveNewLinesretain their existing serialization rules. There are no new dependencies, extensions or public API options.Test plan
Before
Literal HTML-looking text, numeric references and link brackets could change meaning after export. Escape removal followed by reference decoding could decode an escaped reference. Escaped or code-span brackets could also interfere with link-label boundaries and later matches.
After
Standard CI passes. Extended CI encountered a Windows dependency-install signature-verification timeout before tests; its paired Windows job was cancelled. Firefox and WebKit were not rerun locally on this head.