showdown icon indicating copy to clipboard operation
showdown copied to clipboard

makeMarkdown inserts newline where it's not supposed to

Open diogen737 opened this issue 3 years ago • 2 comments

The makeMarkdown method inserts two newline symbols after each html-like block in the resulting markdown (<sub> in this example, but also with <s> and <u>).

Input:

<p>wtf? and <strong><em>bold</em></strong> again <sub>and</sub> again</p>

Expected output:

wtf? and ***bold*** again <sub>and</sub> again\n\n

Output:

wtf? and ***bold*** again <sub>and</sub>\n\n again\n\n

diogen737 avatar Sep 14 '22 06:09 diogen737

Pretty sure this is caused by https://github.com/showdownjs/showdown/blob/95255984ad80acf745ed74605bd3ad8357dc9b33/src/subParsers/makemarkdown/node.js#L121 Adding this blank line should probably be conditional on the node being a block-level element

layaxx avatar Mar 29 '23 23:03 layaxx