Repository navigation
Conversation
The fault: a copy or a drag of blocks with the text `a <b> c` writes `a \<b> c` to the `text/plain` data. The backslash is not in the document. A paste into another application shows it. The cause: copy and drag make the plain text with the markdown exporter. The exporter puts a backslash before a `<` that a markdown parser reads as HTML (since #3194). That is correct for a markdown file, but the plain text is for a person to read. The fix: the markdown serializer has a new option, `escapes`. With `escapes: "none"`, it writes the text of the blocks as it is. The copy code and the drag code use this option. The default (`"markdown"`) is the behavior before this change, so `blocksToMarkdownLossy` gives the same markdown. The option changes only the text. The backslashes that are a part of the markdown structure stay as before: a hard break, a `|` in a table cell, and the URL of a link.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
Collaborator
Author
|
Closed: |
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.
Summary
A copy, a cut or a drag of more than one block writes markdown escapes into the
text/plaindata:Array<string>becomesArray\<string>. This is onmainsince #3194 (release 0.57.0), which made the markdown export escape a<that a markdown parser reads as HTML.The markdown serializer gets an option,
escapes. Copy and drag useescapes: "none". The default is the behavior before this change, soblocksToMarkdownLossygives the same markdown.Testing
markdownSyntaxText. It fails onmain.Notes
cleanHTMLToMarkdownis a public export, so its new optional parameter is an addition to the public API. An alternative without it: the clipboard code calls the serializer directly.|in a table cell is still\|.