render missing nodes #123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "render-missing-nodes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have some custom nodes that don't have a good markdown equivalent.
Instead of throwing an error that node is unsupported, I think for good defaults we can have
What is the reasoning against defining serializers for these nodes? Silently dropping content by default doesn't seem like the best behavior.
The serializers for nodes which don't have a good markdown equivalent would just be empty string, or plain text equivalent to a paragraph. I would like a single way to handle all of these type of nodes without having to manually add a no-op to
MarkdownSerializereach time I update my schema.What about a
renderMissingNodeoption that defaults to throwing an error to be backwards compatible? Set of nodes serializable to markdown is practically static, anddefaultMarkdownSerializerwith a way to customize default behavior for missing nodes would work for me.prosemirror-markdownis pretty self-contained; I could extendMarkdownSerializerandMarkdownSerializerStateeasily to support this behavior internally.HTML is also a possible output.. I can see
toDOM()being an alternative other people would use; not sure howMarkdownIthandles that though. Ideally,parser(serializer(doc)).eq(doc).Would adding
defaultNodeRendereranddefaultMarkRendereroptions, and exporting 'blank' render functions that do what your proposed fallback does here so that people can plug them in, work for you?Yep that would work!
Working on this, I figured that your
renderMissingNodeproposal made for a nicer API after all. I've called itstrictand implemented in attached patch. Does that solve your use case?It solves both the missing node and mark use cases; thanks Marijn!
Pull request closed