mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.52k stars 864 forks source link

Update defaults to match CommonMark & Github conventions #425

Open zm-cttae opened 1 year ago

zm-cttae commented 1 year ago

Closes #424.
This pull introduces the CommonMark (now Github flavor, Reddit flavor) conventions that people use.

CommonMark is so popular compared to Josh Gruber's original Markdown spec that we should favor it.

zm-cttae commented 1 year ago

@pavelhoral please review!

domchristie commented 1 year ago

Are these defaults specified anywhere? (FWIW the current defaults originate from the John Gruber’s original markdown spec)

zm-cttae commented 1 year ago

John Gruber's spec - the first set of conventions - aren't really used as much nowadays 🤔

These GitHub conventions are all listed here, but never explained as "conventions":

zm-cttae commented 1 year ago

Good news 🎉 - CommonMark's Markdown reference help page clearly matches and favours these conventions Per https://commonmark.org/help/

acnebs commented 1 year ago

There is a type in the commit, codeBlockStyle should be fenced not fence.

zm-cttae commented 1 year ago

Cheers thanks for that @acnebs

huan086 commented 1 year ago

br shouldn't be change from hard break '␠␠' to soft break '\n'. When converting to HTML, Common mark states that conversion of hard break is to br, but soft break stays as '\n'. In HTML, '\n' is shown as a space unless the element is style with the various pre styles

zm-cttae commented 1 year ago

Done @huan086

za3k commented 1 month ago

You should get the tests to pass.