Skip to main content

Mdx Truly Sane Lists

Build Status

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 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 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>

Release files for mdx-truly-sane-lists 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdx-truly-sane-lists 1.3
File Size Uploaded
mdx_truly_sane_lists-1.3.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdx-truly-sane-lists 1.3
File Interpreter ABI Platform
mdx_truly_sane_lists-1.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / mdx_truly_sane_lists-1.3.tar.gz

Download URL mdx_truly_sane_lists-1.3.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b661022df7520a1e113af7c355c62216b384c867e4f59fb8ee7ad511e6e77f45
BLAKE2b-256 checksum
How to use checksums
e62716456314311abac2cedef4527679924e80ac4de19dd926699c1b261e0b9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / mdx_truly_sane_lists-1.3-py3-none-any.whl

Download URL mdx_truly_sane_lists-1.3-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9546a4c40ff8f1ab692f77cee4b6bfe8ddf9cccf23f0a24e71f3716fe290a37
BLAKE2b-256 checksum
How to use checksums
3a9edcd1027f7fd193aed152e01c6651a197c36b858f2cd1425ad04cb31a34fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.3 This release

2 release files

1.2

2 release files

1.1.1

2 release files

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page