# mdformat-tight-lists
[![Build Status][ci-badge]][ci-link]
[![PyPI version][pypi-badge]][pypi-link]
An [mdformat](https://github.com/executablebooks/mdformat) plugin that formats Markdown lists to be tight (no empty lines between list items) following mdformat-style rules.
## Installation
```bash
pip install mdformat-tight-lists
```
Or with [pipx](https://pipx.pypa.io/) for command-line usage:
```bash
pipx install mdformat
pipx inject mdformat mdformat-tight-lists
```
## Usage
After installation, mdformat will automatically use this plugin when formatting Markdown files:
```bash
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:**
```markdown
- Item 1
- Item 2
- Item 3
```
**Output:**
```markdown
- Item 1
- Item 2
- Item 3
```
**Multi-paragraph items (loose list preserved):**
```markdown
- First item with multiple paragraphs
Second paragraph of first item
- Second item
```
## Development
### Setup
```bash
# 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
```bash
# 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.
[ci-badge]: https://github.com/jdmonaco/mdformat-tight-lists/workflows/CI/badge.svg
[ci-link]: https://github.com/jdmonaco/mdformat-tight-lists/actions?query=workflow%3ACI+branch%3Amain+event%3Apush
[pypi-badge]: https://img.shields.io/pypi/v/mdformat-tight-lists.svg
[pypi-link]: https://pypi.org/project/mdformat-tight-lists
Raw data
{
"_id": null,
"home_page": null,
"name": "mdformat_tight_lists",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "mdformat, markdown, markdown-it, formatter, lists",
"author": null,
"author_email": "Joseph Monaco <joe@selfmotion.net>",
"download_url": "https://files.pythonhosted.org/packages/8b/45/0a2844db22026bfbd8d3b99546ef4633405d8bcf98ee4b83be679d57c871/mdformat_tight_lists-0.1.1.tar.gz",
"platform": null,
"description": "# mdformat-tight-lists\n\n[![Build Status][ci-badge]][ci-link]\n[![PyPI version][pypi-badge]][pypi-link]\n\nAn [mdformat](https://github.com/executablebooks/mdformat) plugin that formats Markdown lists to be tight (no empty lines between list items) following mdformat-style rules.\n\n## Installation\n\n```bash\npip install mdformat-tight-lists\n```\n\nOr with [pipx](https://pipx.pypa.io/) for command-line usage:\n\n```bash\npipx install mdformat\npipx inject mdformat mdformat-tight-lists\n```\n\n## Usage\n\nAfter installation, mdformat will automatically use this plugin when formatting Markdown files:\n\n```bash\nmdformat your-file.md\n```\n\n### Features\n\n- **Smart List Formatting**: Automatically creates tight lists by removing unnecessary empty lines\n- **List Type Detection**: Different top-level markers (`-`, `*`, `+`) are treated as separate lists\n- **Nested List Handling**: Properly handles transitions between ordered and unordered lists\n- **Multi-Paragraph Support**: Preserves loose formatting when list items contain multiple paragraphs\n\n### Examples\n\n**Input:**\n```markdown\n- Item 1\n\n- Item 2\n\n- Item 3\n```\n\n**Output:**\n```markdown\n- Item 1\n- Item 2\n- Item 3\n```\n\n**Multi-paragraph items (loose list preserved):**\n```markdown\n- First item with multiple paragraphs\n\n Second paragraph of first item\n\n- Second item\n```\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/jdmonaco/mdformat-tight-lists.git\ncd mdformat-tight-lists\n\n# Install development environment with uv\nuv sync\n```\n\n### Running Tests\n\n```bash\n# Run all tests\nuv run pytest\n\n# Run with coverage\nuv run pytest --cov=mdformat_tight_lists\n\n# Run tests verbosely\nuv run pytest -v\n```\n\n### Adding Tests\n\nTo add new test cases, edit `tests/fixtures.md` following the existing format:\n- Test title\n- Input markdown (between dots)\n- Expected output (between dots)\n\n## License\n\nMIT - see LICENSE file for details.\n\n[ci-badge]: https://github.com/jdmonaco/mdformat-tight-lists/workflows/CI/badge.svg\n[ci-link]: https://github.com/jdmonaco/mdformat-tight-lists/actions?query=workflow%3ACI+branch%3Amain+event%3Apush\n[pypi-badge]: https://img.shields.io/pypi/v/mdformat-tight-lists.svg\n[pypi-link]: https://pypi.org/project/mdformat-tight-lists\n\n",
"bugtrack_url": null,
"license": null,
"summary": "An mdformat plugin for creating tight lists (no empty lines between list items).",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/jdmonaco/mdformat-tight-lists"
},
"split_keywords": [
"mdformat",
" markdown",
" markdown-it",
" formatter",
" lists"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "46fd9927fd12ba91c19b8025ff3327656dd9e904af32df0d9db5b36b11282f12",
"md5": "c792c248e5e67d94592dbffa94b8ae41",
"sha256": "ec3f819949352b2659d7658fd6567cd19de5f3c58b18b13337cad9ba9e93d49d"
},
"downloads": -1,
"filename": "mdformat_tight_lists-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c792c248e5e67d94592dbffa94b8ae41",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5116,
"upload_time": "2025-07-30T15:38:36",
"upload_time_iso_8601": "2025-07-30T15:38:36.610621Z",
"url": "https://files.pythonhosted.org/packages/46/fd/9927fd12ba91c19b8025ff3327656dd9e904af32df0d9db5b36b11282f12/mdformat_tight_lists-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8b450a2844db22026bfbd8d3b99546ef4633405d8bcf98ee4b83be679d57c871",
"md5": "27707f296b86db485d2e2b94461295f6",
"sha256": "6efa654ddf7056a860233ee30b6c6f667debb1a8c381148b7fc3110682c4087f"
},
"downloads": -1,
"filename": "mdformat_tight_lists-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "27707f296b86db485d2e2b94461295f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4495,
"upload_time": "2025-07-30T15:38:37",
"upload_time_iso_8601": "2025-07-30T15:38:37.455423Z",
"url": "https://files.pythonhosted.org/packages/8b/45/0a2844db22026bfbd8d3b99546ef4633405d8bcf98ee4b83be679d57c871/mdformat_tight_lists-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 15:38:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jdmonaco",
"github_project": "mdformat-tight-lists",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mdformat_tight_lists"
}