Potential bug in datocms-html-to-structured-text npm package

Thank you for the explanation, @jearle! Iā€™ll bring up the <del> vs <s> situation with the devs and see if they have any thoughts. I canā€™t promise that weā€™ll support importing <del> after thatā€¦ probably depends on what they think of the <ins> situation. But Iā€™ll let you know as soon as I hear back!

For your use case, it might be good to not only handle the <del> tag but also have the importer check for any other unsupported tags?

In general though, I should probably clarify something:

HTML and Structured Text are not really meant to be direct equivalents (thatā€™s why there is a HTML field type), and conversions between them will be lossy more often than not. Structured Text is neither a subset nor superset of HTML, but its own thing, that just happens to share some overlap with simpler HTML constructs like paragraphs, headings, etc. Itā€™s kinda like Markdown in that regard; thereā€™s not necessarily a 1:1 equivalence except in the simplest cases.

There are many situations where going from one to the other will result in lossy conversions. Some random examples:

Not saying this to be pedantic, but to clarify that, by design, itā€™s not a 100%-fidelity HTML import or export. Itā€™s its own format meant to encapsulate some basic rich text, yes, but also more complex relationships expressed in a CMS that HTML doesnā€™t readily handle.

Itā€™s expected that different users will write their own handlers to define the imported schema and output behavior that they want (such as importing into custom blocks and out as custom node renderers).

In your case, during this transition period, it might be helpful to have two fields inside each DatoCMS record: one field can be the ā€œwork in progressā€ Structured Text that your input converter creates, and another can be the ā€œbackupā€ raw HTML from your original CMS, just in case there are any other unaccounted-for tags you need to fix in the future.


In any case, thank you again for this clarification, and Iā€™ll let the devs know about the <del> situation!