trentm / python-markdown2

markdown2: A fast and complete implementation of Markdown in Python
Other
2.66k stars 433 forks source link

Add `middle-word-em` extra #522

Closed Crozzers closed 1 year ago

Crozzers commented 1 year ago

This PR closes #38 by adding an extra to disable emphasis syntax when in the middle of a word.

The current behaviour of the library is to always convert this_text_here to this<em>text</em>here. However, this is not always desirable, as highlighted in #38.

The new middle-word-em extra will allow users to allow (default) or disallow this behaviour by passing extras={'middle-word-em': True/False}. When disabled, any emphasis will be required to have a word boundary (r'\b') surrounding it.

For backwards compatibility, I've kept the default behaviour as allowing middle word emphasis. Users must explicitly disable it. Passing extras=['middle-word-em'] will not work.

nicholasserra commented 1 year ago

Score LGTM thank you