https://github.com/radude/mdx_truly_sane_lists
Extension for Python-Markdown that makes lists truly sane. Custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.
https://github.com/radude/mdx_truly_sane_lists
extension markdown markdown-extension markdown-extra markup python-markdown
Last synced: 8 months ago
JSON representation
Extension for Python-Markdown that makes lists truly sane. Custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.
- Host: GitHub
- URL: https://github.com/radude/mdx_truly_sane_lists
- Owner: radude
- License: mit
- Created: 2018-02-01T18:01:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-08-08T12:02:52.000Z (almost 3 years ago)
- Last Synced: 2025-10-21T19:59:19.293Z (8 months ago)
- Topics: extension, markdown, markdown-extension, markdown-extra, markup, python-markdown
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 98
- Watchers: 3
- Forks: 10
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mdx Truly Sane Lists
[](https://travis-ci.org/radude/mdx_truly_sane_lists)
An extension for [Python-Markdown](https://github.com/Python-Markdown/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 to `2`. 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 weird `p`, no extra linebreaks, no longer fuses lists together when they shouldn't be fused (see screenshots and examples below). Defaults to `True`.
* Inherits [sane lists](https://python-markdown.github.io/extensions/sane_lists/) behavior, which doesn't allow the mixing of ordered and unordered lists.
## Installation
##### [Pypi](https://pypi.python.org/pypi/mdx-truly-sane-lists):
```console
pip3 install mdx_truly_sane_lists
```
##### Directly from git:
```console
pip3 install git+git://github.com/radude/mdx_truly_sane_lists
```
## Usage
Basic:
```python
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:
```python
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](https://rentry.co/) (uses `nested_indent: 2, truly_sane: True`)
Some ugly screenshots because I'm lazy and cannot into gimp:


## HTML
Data:
```markdown
- attributes
- customer
- first_name
- family_name
- email
- person
- first_name
- family_name
- birth_date
- subscription_id
- request
```
No extension:
```html before
-
attributes
-
customer
- first_name
- family_name
- person
- first_name
- family_name
- birth_date
-
subscription_id
-
request
```
Truly sane + 4 spaces:
```html
- attributes
- customer
- first_name
- family_name
- person
- first_name
- family_name
- birth_date
- subscription_id
- request
```