syntax-tree / mdast-util-to-markdown

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

Investigate whether it’s worth it to escape certain whitespace (tabs, spaces) #41

Closed wooorm closed 3 years ago

wooorm commented 3 years ago

Initial checklist

Problem

I was working today on reverse engineering GH, focussed on its slugging algo. I had to figure out whether spaces are handled part of the slugging algorithm, or trimmed. I couldn’t use mdast and mdast-util-to-markdown to put spaces in text around text inside headings, and instead had to hack an escape-hatch: https://github.com/Flet/github-slugger/pull/38/files#diff-04d6b519dad11fd7ce3eb27c6f96e888f7fd787421ffcaff49b3b1d2014ac04eR45.

Solution

Perhaps tabs and spaces around line breaks, such as a value of ' a ' in a heading, where both sides are next to a line break, those tabs and spaces need to be encoded as character references?

Alternatives

Status quo? 🤷‍♂️