Repository navigation
step-recorder: fix selection - #93
Merged
Merged
Conversation
etrepum
pushed a commit
to etrepum/lexical
that referenced
this pull request
Oct 31, 2026
## Description Merges main at cfcd3c4, which brings meta#9600 (escape a literal bracket only where it would start a link). It conflicted with this branch in four files: - `MarkdownExport.ts`: text escaping keeps this branch's `shouldPreserveNewLines` backslash handling and `toCharacterReference`, and routes default-mode text through meta#9600's `$escapeLiteralBrackets` instead of writing every bracket as a reference. meta#9600's bracket helpers sit beside this branch's piece joining. - `importTextMatchTransformer.ts`: `matchLink` combines meta#9600's code-span rules (no link opens inside a code span, or has its `](` or `)` in one) with this branch's bounded search (stop at the last `](`, jump over escaped openers, start at the real opener). A search rejected for a code span now jumps to the code span's end or the label's last character, since every `[` before it finds the same rejected link. The code spans come from the line's format scan when the code transformer is present. A link with an empty label after its real opener, as in `x[[](u)`, now stays text as meta#9600 has it, like `[](u)` does, rather than becoming an empty link that dropped `](u)`. - `LexicalMarkdown.test.ts`: `[hello]](https://lexical.dev)[world](...)` exports as `[hello]&meta#93;(https://lexical.dev)[world](https://lexical.dev)`: meta#9600's bracket escape, plus this branch's spoiled scheme so that GFM readers do not run the URL on into the next link. - `MarkdownEscaping.test.ts`: both sides made the same change to the unbalanced-link test; main's version is kept. ## Test plan Command: `pnpm exec vitest run --project unit packages/lexical-markdown packages/lexical-mdast packages/lexical-playground/__tests__/unit scripts/__tests__/unit/treeShakingSource.test.ts` ### After ``` Test Files 46 passed (46) Tests 1599 passed (1599) ``` `matchLink` was compared with main's on 150,000 random lines of brackets, parentheses, escapes and backticks, using the same code spans: no differences. Export and import round trips of 20,000 random paragraphs with links, brackets, formats and bare URLs found none that main reads back correctly and this branch does not, in either `@lexical/markdown` or `@lexical/mdast`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
I was not checking that the element focus was within the editor, so if you clicked outside and then tried to record, the path generation went on forever