mdast-util-to-markdown: prevent linebreaks occurring between list items?

304 Views Asked by At

For some context I am trying to build a Slate.js based editor that can convert the editor contents to markdown. To do this I am using remark-slate-transformer, which itself uses mdast-util-to-markdown, which has a tendency to insert line breaks between every element it joins. Indeed, rendering lists tends to look like this:

# Bulleted list

-   Hello

    -   Subpoint

    -   Please don't be line breaks

-   Jawohl

# Numbered list

1.  First item

2.  Second item

Whereas the desired result would be:

# Bulleted list

-   Hello
    -   Subpoint
    -   Please don't be line breaks
-   Jawohl

# Numbered list

1.  First item
2.  Second item

The documentation doesn't make it particularly clear how this can be acheived; therefore, what is the best way to go about achieving the desired result using the specified toolkit? My guess would be using the join or handlers members of the options object/parameter but it's not clear to me how this would be achieved.

0

There are 0 best solutions below