showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.25k stars 1.56k forks source link

Bold text breaks if it starts or ends with a space #975

Open marekdedic opened 1 year ago

marekdedic commented 1 year ago

Hi, I am encountering this problem with showdown - the first line is correct, the other two are IMHO incorrect

Input:

This text has a **bold** word.
This text has a ** bold** word.
This text has a **bold ** word.

Expected output:

This text has a <b>bold</b> word.
This text has a <b> bold</b> word.
This text has a <b>bold </b> word.

Actual output:

This text has a <b>bold</b> word.
This text has a ** bold** word.
This text has a **bold ** word.

Might be related to #726 and #741