Preserve whitespace between Slate and CiceroMark #362
Labels
Difficulty: Medium
Type: Feature Request ποΈ
New feature or request
Type: Need Investigation π¬
Feature Request ποΈ
When the user is editing using the Slate editor they are free to insert blank paragraphs to add additional whitespace to their documents. This whitespace is currently lost when the Slate DOM is converted to CiceroMark (which happens when you copy/paste the contents to convert it to HTML.)
Use Case
Allows users to have whitespace within their documents.
Possible Solution
This line removes empty paragraphs when converting from Slate to CiceroMark:
markdown-transform/packages/markdown-slate/lib/slateToCiceroMarkDom.js
Line 86 in f68f7a3
While this handles the conversion from CiceroMark to Slate:
https://github.com/accordproject/markdown-transform/blob/master/packages/markdown-slate/lib/ToSlateVisitor.js#L532
CiceroMark whitespace handling should be consistent with markdown (i.e. whitespace is not significant), however you can force a hard line break in markdown using
\
(see output from https://spec.commonmark.org/dingus/ using the markdown below)So, one approach would be to replace empty paragraphs in the Slate DOM with hard line breaks in the CiceroMark DOM (and vice-a-versa, to preserve roundtripping).
Context
Detailed Description
The text was updated successfully, but these errors were encountered: