syntax-tree / mdast-util-to-markdown

mdast utility to serialize markdown
http://unifiedjs.com
MIT License
100 stars 20 forks source link

roundtripping causes implicitly closed code block to disappear #24

Closed ChristianMurphy closed 3 years ago

ChristianMurphy commented 3 years ago

Subject of the issue


:notebook: note the tab at the end of the second line, it is significant

is stringified as:

````markdown

which changes the structure

Your environment

Steps to reproduce

parse


which has the structure

```json
{
    "type": "root",
    "children": [
        {
            "type": "code"
        }
    ]
}

and stringify it:

the resulting markdown has a different structure than the original

{
    "type": "root",
    "children": []
}

:notebook: comparing how the two pieces of markdown text are being parsed with https://spec.commonmark.org/dingus it appears in both cases it is parsed as expected.

Expected behavior

structure is the same

Actual behavior

structure is different

wooorm commented 3 years ago

It’s not about closing, it’s about blank lines in fenced code possibly existing, but not in indented code