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

[md-serializer] add br html element rule for md serialize #3223

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dimaanj
Copy link
Collaborator

@dimaanj dimaanj commented May 28, 2024

Summary

Add <br/> serialize for md.

@dimaanj dimaanj requested review from 12joan and zbeyens May 28, 2024 13:36
@dimaanj dimaanj self-assigned this May 28, 2024
Copy link

changeset-bot bot commented May 28, 2024

🦋 Changeset detected

Latest commit: d27d9f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@udecode/plate-serializer-md Patch
@udecode/plate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 8:58am

zbeyens
zbeyens previously approved these changes May 28, 2024
@@ -294,7 +294,7 @@ describe('deserializeMd', () => {
<fragment>
<hp>
<htext>Line 1</htext>
<htext>{'\n'}</htext>
<htext>{'<br>'}</htext>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Expecting this to return a text node containing the string '<br>' doesn't seem right to me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@zbeyens zbeyens marked this pull request as draft June 6, 2024 14:18
@dimaanj dimaanj marked this pull request as ready for review June 7, 2024 08:49
@dimaanj dimaanj requested review from 12joan and zbeyens June 7, 2024 08:49
Comment on lines +297 to +299
<hp>
<htext></htext>
</hp>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nesting paragraphs isn't valid HTML markup. I think \n is the only natural choice for deserializing a <br> element.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but how you will detect \n when serialising it back to <br>?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could convert all \n characters occuring in text nodes to <br>, or just keep them as \ns. That would be the most natural choice for the majority of Plate's users; if you need something different in your app, it might be best to do that in your own source code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, will update it

@zbeyens zbeyens marked this pull request as draft June 23, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants