An mdformat plugin for creating tight lists (no empty lines between list items).
Project description
mdformat-tight-lists
An mdformat plugin that formats Markdown lists to be tight (no empty lines between list items) following mdformat-style rules.
Installation
pip install mdformat-tight-lists
Or with pipx for command-line usage:
pipx install mdformat
pipx inject mdformat mdformat-tight-lists
Usage
After installation, mdformat will automatically use this plugin when formatting Markdown files:
mdformat your-file.md
Features
- Smart List Formatting: Automatically creates tight lists by removing unnecessary empty lines
- List Type Detection: Different top-level markers (
-,*,+) are treated as separate lists - Nested List Handling: Properly handles transitions between ordered and unordered lists
- Multi-Paragraph Support: Preserves loose formatting when list items contain multiple paragraphs
Examples
Input:
- Item 1
- Item 2
- Item 3
Output:
- Item 1
- Item 2
- Item 3
Multi-paragraph items (loose list preserved):
- First item with multiple paragraphs
Second paragraph of first item
- Second item
Development
Setup
# Clone the repository
git clone https://github.com/jdmonaco/mdformat-tight-lists.git
cd mdformat-tight-lists
# Install development environment with uv
uv sync
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=mdformat_tight_lists
# Run tests verbosely
uv run pytest -v
Adding Tests
To add new test cases, edit tests/fixtures.md following the existing format:
- Test title
- Input markdown (between dots)
- Expected output (between dots)
License
MIT - see LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdformat_tight_lists-0.1.1.tar.gz.
File metadata
- Download URL: mdformat_tight_lists-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6efa654ddf7056a860233ee30b6c6f667debb1a8c381148b7fc3110682c4087f
|
|
| MD5 |
27707f296b86db485d2e2b94461295f6
|
|
| BLAKE2b-256 |
8b450a2844db22026bfbd8d3b99546ef4633405d8bcf98ee4b83be679d57c871
|
File details
Details for the file mdformat_tight_lists-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mdformat_tight_lists-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec3f819949352b2659d7658fd6567cd19de5f3c58b18b13337cad9ba9e93d49d
|
|
| MD5 |
c792c248e5e67d94592dbffa94b8ae41
|
|
| BLAKE2b-256 |
46fd9927fd12ba91c19b8025ff3327656dd9e904af32df0d9db5b36b11282f12
|