Registry / mdx-truly-sane-lists

mdx-truly-sane-lists

JSON →
library1.3pypypi✓ verified 24d ago

mdx-truly-sane-lists is an extension for Python-Markdown that aims to make lists behave more predictably. It provides features like custom indents for nested lists and fixes for messy linebreaks and paragraphs within lists. The current version is 1.3, released in 2022, with previous major updates in 2018 and 2016, indicating an infrequent release cadence.

pip install mdx-truly-sane-lists
INSTALL
IMPORT
SIG · MDX-TRULY-SANE-LIS
M
mdx-truly-sane-lists
pythonv1.3
Install
1.7s avg
Import
148ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.152s · 18.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.144s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

makeExtension
from mdx_truly_sane_lists import makeExtension
from markdown import markdown

This quickstart demonstrates how to apply the `mdx-truly-sane-lists` extension to Markdown text using the `markdown` function. It shows both basic usage with default settings and how to provide custom configurations for `nested_indent` and `truly_sane` options.

from markdown import markdown # Basic usage with default config (nested_indent: 2, truly_sane: True) text_basic = """ - Item 1 - Nested Item 1 - Double Nested - Item 2 """ html_basic = markdown(text_basic, extensions=['mdx_truly_sane_lists']) print("Basic Render:\n", html_basic) # With explicit config for customization text_config = """ 1. Ordered Item 1 1. Nested Ordered Item 1 2. Ordered Item 2 """ html_config = markdown( text_config, extensions=['mdx_truly_sane_lists'], extension_configs={ 'mdx_truly_sane_lists': { 'nested_indent': 4, # Custom indent, default is 2 'truly_sane': True # Fixes linebreaks/paragraphs, default is True } } ) print("\nConfigured Render:\n", html_config)
Debug
Known issues
breakingIncompatibility with Python-Markdown 3.4+ prior to mdx-truly-sane-lists v1.3. Older versions of this extension would fail to load with Python-Markdown versions 3.4 and newer, resulting in 'Failed loading extension' errors.
fix
Upgrade mdx-truly-sane-lists to version 1.3 or newer. If an upgrade is not possible, pin the 'Markdown' package dependency to a version less than 3.4 (e.g., `Markdown==3.3.7`).
affects: mdx-truly-sane-lists < 1.3 when used with Python-Markdown >= 3.4
breakingIncompatibility with Python-Markdown 3.0+ prior to mdx-truly-sane-lists v1.2. Earlier versions of this extension were not compatible with Python-Markdown 3.0 and above.
fix
Upgrade mdx-truly-sane-lists to version 1.2 or newer.
affects: mdx-truly-sane-lists < 1.2 when used with Python-Markdown >= 3.0
gotchaOrdered lists not starting at '1' may not render as expected. When used, especially with MkDocs Material, ordered lists that do not explicitly start with `1.` (e.g., `5. Item A`) might not be processed correctly by the extension, potentially overriding Python-Markdown's default `sane_lists` behavior for such cases.
fix
Ensure ordered lists start from `1.`. For MkDocs users, a workaround involves adding a hook to patch the `TrulySaneOListProcessor` to set `LAZY_OL = False` (refer to GitHub issue #21 for details).
affects: All versions (inherent behavior interacting with default Markdown parsing)
gotchaThe extension enforces 'sane lists' behavior, disallowing the mixing of ordered and unordered list items without proper separation. This is an intentional design choice but can be unexpected for users accustomed to more lenient Markdown parsers.
fix
Always separate different list types (ordered vs. unordered) with a blank line if they are meant to be distinct lists, or maintain a consistent list type within a logical block to avoid unintended merging or rendering issues.
affects: All versions (inherent design feature)
Upgrade
Version history
1.3latest on PyPI · released Jul 19, 2022
Audit
Dependencies
MarkdownrequiredThis is a Python-Markdown extension and requires the core Markdown library to function.
Agent activity
1 hits · last 30 days
Resources
mdx-truly-sane-lists — pip install mdx-truly-sane-lists · libregistry