Extension for Python-Markdown that makes lists truly sane. Custom indents for nested lists and fix for messy linebreaks.
Project description
Mdx Truly Sane Lists
An extension for Python-Markdown that makes lists truly sane. Features custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.
Features
-
nested_indent
option: Custom indent for nested lists. Defaults to2
. Doesn't mess with code indents, which is still 4. -
truly_sane
option: Makes linebreaks and paragraphs in lists behave as usually expected by user. No longer adds weirdp
, no extra linebreaks, no longer fuses lists together when they shouldn't be fused (see screenshots and examples below). Defaults toTrue
. -
Inherits sane lists behavior, which doesn't allow the mixing of ordered and unordered lists.
Installation
Pypi:
pip3 install mdx_truly_sane_lists
Directly from git:
pip3 install git+git://github.com/radude/mdx_truly_sane_lists
Usage
Basic:
from markdown import markdown # Default config is truly_sane: True, nested_indent: 2 markdown(text='some text', extensions=['mdx_truly_sane_lists'])
With explicit config:
from markdown import markdown markdown(text='some text', extensions=[ 'mdx_truly_sane_lists', ], extension_configs={ 'mdx_truly_sane_lists': { 'nested_indent': 2, 'truly_sane': True, }}, )
Screenshots and examples
You can preview the new behaviour live at rentry.co (uses nested_indent: 2, truly_sane: True
)
Some ugly screenshots because I'm lazy and cannot into gimp:
HTML
Data:
- attributes - customer - first_name - family_name - email - person - first_name - family_name - birth_date - subscription_id - request
No extension:
<ul> <li> <p>attributes</p> </li> <li> <p>customer </p> <ul> <li>first_name</li> <li>family_name</li> <li>email</li> </ul> </li> <li>person<ul> <li>first_name</li> <li>family_name</li> <li>birth_date</li> </ul> </li> <li> <p>subscription_id</p> </li> <li> <p>request</p> </li> </ul>
Truly sane + 4 spaces:
<ul> <li>attributes</li> </ul> <ul> <li>customer <ul> <li>first_name</li> <li>family_name</li> <li>email</li> </ul> </li> <li>person<ul> <li>first_name</li> <li>family_name</li> <li>birth_date</li> </ul> </li> <li>subscription_id</li> </ul> <ul> <li>request</li> </ul>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mdx_truly_sane_lists-1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc8bfa00f331403504e12377a9c94e6b40fc7db031e283316baeeeeac68f1da9 |
|
MD5 | ff146e0ce7d4e5abce9bd554e1fef792 |
|
BLAKE2-256 | 05d850d108921125389b2853aab2a93a1dbcf469b52f2f8521bcf6a2410cc6e5 |