patleeman / quill-markdown-shortcuts

Quill.js module that converts markdown to rich text formatting while typing.
https://patleeman.github.io/quill-markdown-shortcuts/
139 stars 49 forks source link

Avoid intra-word matching with underscores #36

Closed bartram2 closed 4 years ago

bartram2 commented 4 years ago

According to this Markdown Guide:

Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold the middle of a word for emphasis.

This PR changes the patterns for bold, italic, and bolditalic to prevent matches on intra-word underscores. This is helpful to avoid matches on SNAKE_CASE words like I_LIKE_CHEESE.

It also fixes an issue where it would match on words with differing start and end patterns, e.g. _CHEESE* would result in a match.