Note
This plugin's functionality has been integrated into mdformat-space-control, which combines tight list formatting with EditorConfig support. Consider using mdformat-space-control for new projects.
An mdformat plugin that formats Markdown lists to be tight (no empty lines between list items) following mdformat-style rules.
pip install mdformat-tight-listsOr with pipx for command-line usage:
pipx install mdformat
pipx inject mdformat mdformat-tight-listsAfter installation, mdformat will automatically use this plugin when formatting Markdown files:
mdformat your-file.md- 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
Input:
- Item 1
- Item 2
- Item 3Output:
- Item 1
- Item 2
- Item 3Multi-paragraph items (loose list preserved):
- First item with multiple paragraphs
Second paragraph of first item
- Second item# Clone the repository
git clone https://github.com/jdmonaco/mdformat-tight-lists.git
cd mdformat-tight-lists
# Install development environment with uv
uv sync# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=mdformat_tight_lists
# Run tests verbosely
uv run pytest -vTo add new test cases, edit tests/fixtures.md following the existing format:
- Test title
- Input markdown (between dots)
- Expected output (between dots)
MIT - see LICENSE file for details.