Skip to content

[lexical-markdown] Bug Fix: Decode hexadecimal character references - #9470

Closed
Vl4dC wants to merge 1 commit into
meta:mainfrom
Vl4dC:codex/markdown-hex-character-refs
Closed

Vl4dC wants to merge 1 commit into
meta:mainfrom
Vl4dC:codex/markdown-hex-character-refs

Conversation

@Vl4dC

@Vl4dC Vl4dC commented Oct 27, 2026

Copy link
Copy Markdown

Description

@lexical/markdown currently leaves hexadecimal numeric character references such as A literal during import, including in link destinations and titles. Decode them alongside decimal references and backslash escapes in a single pass. The single pass also keeps escaped ampersands literal and avoids rescanning an ampersand produced by a reference.

Closes #9469

Test plan

Before

pnpm exec vitest run packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts --project unit -t 'hexadecimal character references' with the original utils.ts:

Tests  7 failed | 2 passed | 610 skipped (619)
Expected: "aAb"
Received: "aAb"

After

pnpm exec vitest run packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts --project unit:

Test Files  1 passed (1)
Tests  619 passed (619)

pnpm exec prettier --check and pnpm exec eslint passed for both changed files. The commit hook also ran Prettier and ESLint successfully.

## Description

Markdown import leaves valid hexadecimal numeric character references literal in text and link fields. Decode decimal and hexadecimal references alongside backslash escapes in one pass, so escaped ampersands remain literal and replacement text is not scanned again.

Closes meta#9469

## Test plan

### Before

`pnpm exec vitest run packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts --project unit -t 'hexadecimal character references'` with the original `utils.ts`:

`Tests  7 failed | 2 passed | 610 skipped (619)`
`Expected: "aAb"`
`Received: "aAb"`

### After

`pnpm exec vitest run packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts --project unit`:

`Test Files  1 passed (1)`
`Tests  619 passed (619)`

`pnpm exec prettier --check` and `pnpm exec eslint` on both changed files passed.
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 27, 2026 12:27am UTC
lexical-playground Ready Ready Preview Oct 27, 2026 12:27am UTC

Request Review

@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Hi @Vl4dC!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown
lexical

npm i https://pkg.pr.new/lexical@9470

@lexical/a11y

npm i https://pkg.pr.new/@lexical/a11y@9470

@lexical/clipboard

npm i https://pkg.pr.new/@lexical/clipboard@9470

@lexical/code

npm i https://pkg.pr.new/@lexical/code@9470

@lexical/code-core

npm i https://pkg.pr.new/@lexical/code-core@9470

@lexical/code-prism

npm i https://pkg.pr.new/@lexical/code-prism@9470

@lexical/code-shiki

npm i https://pkg.pr.new/@lexical/code-shiki@9470

@lexical/compiler

npm i https://pkg.pr.new/@lexical/compiler@9470

@lexical/devtools-core

npm i https://pkg.pr.new/@lexical/devtools-core@9470

@lexical/dragon

npm i https://pkg.pr.new/@lexical/dragon@9470

@lexical/eslint-plugin

npm i https://pkg.pr.new/@lexical/eslint-plugin@9470

@lexical/extension

npm i https://pkg.pr.new/@lexical/extension@9470

@lexical/fast-check

npm i https://pkg.pr.new/@lexical/fast-check@9470

@lexical/file

npm i https://pkg.pr.new/@lexical/file@9470

@lexical/hashtag

npm i https://pkg.pr.new/@lexical/hashtag@9470

@lexical/headless

npm i https://pkg.pr.new/@lexical/headless@9470

@lexical/history

npm i https://pkg.pr.new/@lexical/history@9470

@lexical/html

npm i https://pkg.pr.new/@lexical/html@9470

@lexical/internal

npm i https://pkg.pr.new/@lexical/internal@9470

@lexical/link

npm i https://pkg.pr.new/@lexical/link@9470

@lexical/list

npm i https://pkg.pr.new/@lexical/list@9470

@lexical/mark

npm i https://pkg.pr.new/@lexical/mark@9470

@lexical/markdown

npm i https://pkg.pr.new/@lexical/markdown@9470

@lexical/mdast

npm i https://pkg.pr.new/@lexical/mdast@9470

@lexical/offset

npm i https://pkg.pr.new/@lexical/offset@9470

@lexical/overflow

npm i https://pkg.pr.new/@lexical/overflow@9470

@lexical/plain-text

npm i https://pkg.pr.new/@lexical/plain-text@9470

@lexical/react

npm i https://pkg.pr.new/@lexical/react@9470

@lexical/rich-text

npm i https://pkg.pr.new/@lexical/rich-text@9470

@lexical/selection

npm i https://pkg.pr.new/@lexical/selection@9470

@lexical/table

npm i https://pkg.pr.new/@lexical/table@9470

@lexical/tailwind

npm i https://pkg.pr.new/@lexical/tailwind@9470

@lexical/text

npm i https://pkg.pr.new/@lexical/text@9470

@lexical/utils

npm i https://pkg.pr.new/@lexical/utils@9470

@lexical/yjs

npm i https://pkg.pr.new/@lexical/yjs@9470

commit: 5cf7656

@etrepum

etrepum commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #9481

@etrepum etrepum closed this Oct 29, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 5cf7656d Deployed Oct 27, 2026 by vercel[bot]
Preview – lexical-playground — 5cf7656d Deployed Oct 27, 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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Markdown import leaves hexadecimal character references literal

2 participants