Repository navigation
Add HTML deserialization recipe to docs - #4432
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
zurfyx
left a comment
There was a problem hiding this comment.
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.
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.