Repository navigation
[lexical-text] Chore: Add deprecation notice to $findTextIntersectionFromCharacters - #8364
Merged
etrepum merged 2 commits intoApr 17, 2026
Merged
Conversation
etrepum
requested review from
acywatson,
fantactuka,
potatowagon,
takuyakanbr and
zurfyx
as code owners
April 17, 2026 06:47
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
Related #4103 (comment) |
zurfyx
approved these changes
Apr 17, 2026
Merged
zurfyx
added a commit
that referenced
this pull request
Oct 31, 2026
…flank, as written, and leave every other export byte for byte as it was ## Description Review follow-up. The first version decided per text node, from a model of the tags the export would write, which character to write as a reference. The model missed tags the export closes and opens again in one run (`****` between two nodes that share some formats), counted ASCII-only punctuation as CommonMark does not, stopped following one-character texts after 64 nodes, and could write a C1 control as a reference (`€`, which CommonMark reads as `€`). So it changed exports that already read back (`*(beta)***€**` got `€`) and broke one (`***😀****a\_b*`). Now the export of a block's inline content is built as pieces (tags, the first and last character of each text node, everything else as written), and each run of tags is checked against the characters actually next to it. A run is changed only where it fails CommonMark's flanking rules both as CommonMark classes characters and as parsers that read UTF-16 units do (they disagree on emoji and other characters outside the Basic Multilingual Plane); then the letter or digit on the failing side is written as a reference, and the runs next to that character are checked again, over the whole block. Where this package's import, which counts only ASCII punctuation, would then see a reference next to a character it takes for a letter (`€`), that character is written as a reference too. Only letters, marks, digits, symbols and punctuation are ever written as references (never control characters). Markdown that every reading accepts as written is unchanged. ## Test plan `EmphasisFlanking.test.ts` now reads every case back with this package's import and with a CommonMark parser (micromark, through @lexical/mdast), and adds the review's byte-identity controls (`*(beta)***€**`, `**a.***€*`, `*—***.**`), the emoji run parsers disagree on (unchanged), and a C1 control (unchanged); the properties run 1,500 random paragraphs through this package's import (ASCII punctuation, all formats) and through micromark (Unicode punctuation; bold, italic, strikethrough, code). ### Before On 3f30041, with the review's repros and six parsers (commonmark.js, markdown-it, marked, micromark, micromark with GFM): ``` review Regressions: byte-identity controls fail (`*(beta)***€**` and two more), shared-format reference fails commonmark.js review C1: `**Hello,**€` reads back as `€` ``` On main (c363dd9): review Contexts 9 of 15 and Chain 7 of 7 fail (the issue). ### After ``` $ vitest --run --project unit packages/lexical-markdown/src/__tests__/unit/EmphasisFlanking.test.ts Tests 20 passed (20) $ LEXICAL_MARKDOWN_SEEDS=6000 vitest --run ... EmphasisFlanking.test.ts Tests 20 passed (20) review repros on this head: Contexts 15/15, Chain 7/7 (16 to 256 one-character nodes), C1 5/5, Reference 1/1, Regressions: the three byte-identity controls and commonmark.js pass; micromark, markdown-it and marked read the shared-format case (`***😀****a\_b*`, byte for byte main's export) as main does. $ pnpm run ci-check EXIT 0 $ vitest --run --project unit --project scripts-unit Test Files 657 passed | 4 skipped (661) Tests 28189 passed | 424 expected fail | 135 skipped (28748) ``` A corpus of 6,000 random paragraphs (ASCII and Unicode punctuation, emoji, `*`, `_`, a C1 control; bold, italic, code), compared with main's export: 939 differ, none where main's export read back in all four parsers and this package's import; 0 parser regressions; 847 to 867 cases fixed per parser; this package's import fixed in 531 and broken in 1 (`*—\_***Bc:…`, where main's export failed every parser; this package's import misreads the run after the escaped `\_`; not investigated further).
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
$findTextIntersectionFromCharactersdoesn't work correctly and has no tests, usage, or documentation. Like the situation with@lexical/offset, it would be nice to have something like this, but it should be implemented correctly with an in-repo use case, tests, and documentation.Test plan
N/A