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

Merged
merged 3 commits into from
Jan 13, 2025

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.

@GermanJablo GermanJablo enabled auto-merge (squash) January 13, 2025 14:08
@bratvanov
Copy link
Contributor

I found another issue with new lines/</br> tags, but I'm unsure if it's also related to normalizeMarkdown.

This line break is showing <br/> as text when rendering the <Banner type="success"> on the website docs.

@GermanJablo GermanJablo merged commit 0252681 into main Jan 13, 2025
67 checks passed
@GermanJablo GermanJablo deleted the fix-normalize branch January 13, 2025 14:51
Copy link
Contributor

🚀 This is included in version v3.17.0

@GermanJablo
Copy link
Contributor Author

It seems to have been fixed. Thanks for reporting @bratvanov!

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.

3 participants