Byron/pulldown-cmark-to-cmark

Empty lines and whitespace are not preserved

开放

#94 创建于 2025年1月6日

 (5 条评论) (0 个反应) (0 位负责人)Rust (46 个派生)auto 404
bughelp wanted

仓库指标

星标
 (60 个星标)
PR 合并指标
 (平均合并 35分钟) (30 天内合并 1 个 PR)

描述

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

a     



b

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

a

b

I see that in Options 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?

贡献者指南