Byron / Byron/pulldown-cmark-to-cmark

Empty lines and whitespace are not preserved

Open
#94 5 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Rust
Stars
63
Forks
46
PR merge metrics
No merged PRs in 30d

Description

It appears that either `pulldown-cmark` or `pulldown-cmark-to-cmark` itself silently shrinks any number of consecutive empty lines into a single empty line, and also strips trailing whitespace. For example, for this file `test.md`

```markdown
a

b
```

When I run `cargo run --example stupicat test.md` I get

```
a

b
```

I see that in [Options](https://docs.rs/pulldown-cmark-to-cmark/20.0.0/pulldown_cmark_to_cmark/struct.Options.html) there are a number of tweaks to select the number of empty lines after a bunch of elements, but there is no option to preserve empty lines exactly as it was in the source document. (More generally I sought to preserve trailing whitespace after the end of each line as well: after the "a" above there are some spaces, but they are stripped in the output)

How easy would it be to workaround this? I mean, is this a limitation of `pulldown-cmark` itself (like, it throws away this information and there is no way to recover it), or just a missing feature in `pulldown-cmark-to-cmark`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.