-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add HTML deserialization recipe to docs #4432
Add HTML deserialization recipe to docs #4432
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, LGTM! Will delegate the stamp to @acywatson since he's worked the most in this space
@acywatson also wanted to explore what the equivalent for a Heading override would look like and what the difference would be and if there's an alternative to duplication of the logic, besides aggregating all node overrides going to the same node. |
This seems to work only for spans, not for cases like |
you are right, didn't realize it changes the span to strong 🤦🏻♂️ |
static importJSON(serializedNode: SerializedTextNode): TextNode { | ||
return TextNode.importJSON(serializedNode); | ||
} | ||
|
||
exportJSON(): SerializedTextNode { | ||
return super.exportJSON(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines look unnecessary.
@acywatson Should I be doing the bold, italic, etc or just keep the span, strong, em and code ones? |
@fantactuka @acywatson @zurfyx can I get an approval to merge on this one. I've cleaned it up and it's the docs, can always be improved over time. |
I've used the most approved code snippet from the following issue: #2452 as a base to address the case for full style serialization/deserialization of HTML styles to preserve the HTML<>JSON fidelity.
Please comment on what to modify, add, remove. I'd like to make this snippet as canonical as possible, since most people will copy-paste without any modifications. I'd like to treat it as a piece of code in the library, we just can't add to the core. Should help solve a lot of the Discord questions by providing a link.