Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(richtext-lexical): combine 2 normalizeMarkdown implementations and fix code block regex #10470

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GermanJablo
Copy link
Contributor

@GermanJablo GermanJablo commented Jan 9, 2025

This should fix it #10387

I don't know why we had 2 different copies of normalizeMarkdown.

Also, the most up-to-date one still had a bug where lines were considered as if they were inside codeblocks when they weren't.

How I tested that it works:

  1. I copied the normalizeMarkdown implementation from this PR into the website repo, and made sure it is called before the conversion to editorState.
  2. In the admin panel, sync docs.
  3. In the admin panel, refresh mdx to lexical (new button, below sync docs).
  4. Look for the examples from bug Website docs - Markdown to HTML produces abrupt line breaks #10387 and verify that they have been resolved.

An extra pair of eyes would be nice to make sure I'm not getting confused with the imports.

@@ -82,7 +82,7 @@ function $convertFromMarkdownString(
transformers: Array<Transformer> = TRANSFORMERS,
node?: ElementNode,
shouldPreserveNewLines = false,
shouldMergeAdjacentLines = false,
shouldMergeAdjacentLines = true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This classifies as a bug fix rather than a breaking change. It is standard behavior and what most people will expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants