mixmark-io / turndown

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

Update demo default settings with atx headingStyle etc. #391

Open Robbie-Cook opened 3 years ago

Robbie-Cook commented 3 years ago

setext format is not as commonly used as atx, and I had no idea it existed. Can we change the example demo to

const turndownService = new TurndownService({ headingStyle: "atx" });
martincizek commented 3 years ago

I have a few similar ideas a few days ago. I want to refactor the demo a little more, especially add the GFM plugin, that's why I haven't touched it so far. The issue is that the demo reflects Turndown's defaults, so it would be inconcistent. :/ I'd like to change Turndown defaults, but it has to be done with a major version. So I guess we'd need to sacrifice demo consistency temporarily.

The suitable defaults are as follows IMO:

  headingStyle: 'atx',
  hr: '---',
  bulletListMarker: '*',
  codeBlockStyle: 'fenced',
  fence: '```',
  emDelimiter: '*', // unlike underscore, this works also intra-word
  strongDelimiter: '**', // unlike underscores, this works also intra-word
  linkStyle: 'inlined',
  linkReferenceStyle: 'full',
  br: '  ',
  preformattedCode: false,

What do you think?

Robbie-Cook commented 3 years ago

Right, thank you for your comment @martincizek . I understand you can't change the default -- makes sense. I disagree with

The issue is that the demo reflects Turndown's defaults, so it would be inconcistent

though. Having a demo with an option set is, in my mind, not inconsistent. It's more consistent, because it more closely matches most people's idea of markdown

samheutmaker commented 1 year ago

The suitable defaults are as follows IMO:

This is such an underrated comment, thanks for sharing.