trentm / python-markdown2

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

[Documentation] - Extra Line Break Documentation weirdness #585

Closed nv1t closed 4 months ago

nv1t commented 4 months ago

The Documentation for the extra "Line breaks" states the usage as

markdown2.markdown(your_text, extras={'breaks': {'on_newline': True, 'on_backslash': True}})

That is the only place in the documentation where "extras" argument is a dictionary. This is not clear on what to do here?

Crozzers commented 4 months ago

The extras kwarg format is a mapping of extra names to configuration values, as seen in the example above. It can also be supplied as a list of extra names, which is sufficient in most examples.

# this example is valid
markdown2.markdown(text, extras=['fenced-code-blocks', 'breaks'])
# this is equivalent to the above example and is what is used generated inside the Markdown class
markdown2.markdown(text, extras={'fenced-code-blocks': None, 'breaks': None})
# this version supplies additional configuration to the `breaks` extra
markdown2.markdown(text, extras={'breaks': {'on_newline': True, 'on_backslash': True}})

The Extras wiki page has a section on this as well