sstur / draft-js-export-markdown

DraftJS: Export ContentState to Markdown
http://npm.im/draft-js-export-markdown
55 stars 23 forks source link

Do not include whitespace when applying inline markdown styles #14

Open Rosey opened 8 years ago

Rosey commented 8 years ago

If you test out markdown on a gist, markdown like this:

**Test **

(with trailing or leading whitespace) is not properly parsed. (examples here: https://gist.github.com/Rosey/3f848d77b46f7ab337a53211117acd87)

This change only surrounds the text with markdown inline styles and preserves the whitespace, but doesn't attempt to style it, fixing the issue of incompatibility with markdown parsers.


I'm not super confident about the efficiency of my regular expression here. It works, but I am worried that it is not optimal. Perhaps someone with better regex-fu will know if it can be improved performance-wise.

binarybaba commented 5 years ago

@Rosey are you planning to fix the conflicts? Your PR most probably also solved https://github.com/sstur/react-rte/issues/127