Skip to main content

An mdformat plugin for creating tight lists (no empty lines between list items).

Project description

mdformat-tight-lists

Build Status PyPI version

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
  • Frontmatter Compatible: Works seamlessly with YAML frontmatter

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)

Publishing

This package is automatically published to PyPI when a version tag is pushed:

# Update version in mdformat_tight_lists/__init__.py
# Commit and push changes
git add -A
git commit -m "Bump version to X.Y.Z"
git push

# Create and push a version tag
git tag vX.Y.Z
git push origin vX.Y.Z

The GitHub Actions workflow will automatically build and publish to PyPI.

License

MIT - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdformat_tight_lists-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdformat_tight_lists-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file mdformat_tight_lists-0.1.0.tar.gz.

File metadata

  • Download URL: mdformat_tight_lists-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for mdformat_tight_lists-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68014b74d3a3c384e9622311450b785cc60a95f0187fc09c98f1379d54021ec3
MD5 7122bd8f80bc298c9b09a372448c6b7e
BLAKE2b-256 33a2bb61ad8ab3fa67336dbe3c9c20069fd279ef7ca3fc6fe9dbda3718446672

See more details on using hashes here.

File details

Details for the file mdformat_tight_lists-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mdformat_tight_lists-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96151a50bc3e0127b8a72cad6e701090b597fc2c0b7aefd675232347b068692b
MD5 f40b6369d7c43ac452836ab0b4f79bcc
BLAKE2b-256 7733c6bfd37c22208d9389798657df74380614a321560594f53f5670b5af6f1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page