Skip to content

jdmonaco/mdformat-tight-lists

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdformat-tight-lists

Build Status PyPI version

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.

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.

About

An mdformat plugin for tight lights with consistent block and list-type separation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages