{"id":34070845,"url":"https://github.com/jdmonaco/mdformat-editorconfig","last_synced_at":"2026-03-08T21:36:51.247Z","repository":{"id":327079366,"uuid":"1107670619","full_name":"jdmonaco/mdformat-editorconfig","owner":"jdmonaco","description":"An mdformat plugin that applies EditorConfig indentation settings to list formatting.","archived":false,"fork":false,"pushed_at":"2025-12-01T17:40:02.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-04T04:56:20.593Z","etag":null,"topics":["mdformat"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdmonaco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-01T13:06:22.000Z","updated_at":"2025-12-01T17:40:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jdmonaco/mdformat-editorconfig","commit_stats":null,"previous_names":["jdmonaco/mdformat-editorconfig"],"tags_count":3,"template":false,"template_full_name":"jdmonaco/mdformat-tight-lists","purl":"pkg:github/jdmonaco/mdformat-editorconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmonaco%2Fmdformat-editorconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmonaco%2Fmdformat-editorconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmonaco%2Fmdformat-editorconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmonaco%2Fmdformat-editorconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdmonaco","download_url":"https://codeload.github.com/jdmonaco/mdformat-editorconfig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmonaco%2Fmdformat-editorconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27721593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mdformat"],"created_at":"2025-12-14T07:36:06.500Z","updated_at":"2025-12-14T07:36:07.124Z","avatar_url":"https://github.com/jdmonaco.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mdformat-editorconfig\n\n[![Build Status][ci-badge]][ci-link]\n[![PyPI version][pypi-badge]][pypi-link]\n\n\u003e [!NOTE]\n\u003e This plugin's functionality has been integrated into [mdformat-space-control](https://github.com/jdmonaco/mdformat-space-control), which combines EditorConfig support with tight list formatting. Consider using mdformat-space-control for new projects.\n\nAn [mdformat](https://github.com/executablebooks/mdformat) plugin that applies [EditorConfig](https://editorconfig.org/) indentation settings to Markdown formatting.\n\n## Motivation\n\nmdformat uses opinionated defaults for indentation (2 spaces). This plugin allows you to configure indentation via `.editorconfig` files, making mdformat respect your project's or personal indentation preferences.\n\n## Installation\n\n```bash\npip install mdformat-editorconfig\n```\n\nOr with [pipx](https://pipx.pypa.io/) for command-line usage:\n\n```bash\npipx install mdformat\npipx inject mdformat mdformat-editorconfig\n```\n\n## Usage\n\nCreate an `.editorconfig` file in your project (or home directory):\n\n```ini\n# .editorconfig\nroot = true\n\n[*.md]\nindent_style = space\nindent_size = 4\n```\n\nThen format your Markdown files as usual:\n\n```bash\nmdformat your-file.md\n```\n\n### Example\n\nWith the above `.editorconfig`, nested lists will use 4-space indentation:\n\n**Before:**\n```markdown\n- Item 1\n  - Nested item\n- Item 2\n```\n\n**After:**\n```markdown\n- Item 1\n    - Nested item\n- Item 2\n```\n\n### EditorConfig Property Compatibility\n\n| Property | Status | Notes |\n|----------|--------|-------|\n| `indent_style` | ✅ Supported | Plugin applies space/tab indentation to lists |\n| `indent_size` | ✅ Supported | Plugin applies configured indent width to lists |\n| `trim_trailing_whitespace` | ✅ Always enabled | mdformat always trims trailing whitespace by design |\n| `insert_final_newline` | ✅ Always enabled | mdformat always adds final newline by design |\n| `end_of_line` | ⚪ See mdformat | Use mdformat's `--end-of-line` CLI option (`lf`, `crlf`) |\n| `tab_width` | ⚪ Inherited | Used when `indent_size = tab` |\n| `charset` | ⚪ N/A | File encoding is handled by editors, not formatters |\n\n**Note:** mdformat has opinionated defaults that align well with typical `.editorconfig` settings. The formatter always trims trailing whitespace and ensures files end with a newline—these behaviors cannot be disabled.\n\n## How It Works\n\nThe plugin overrides mdformat's list renderers to apply indentation settings from `.editorconfig` files. It:\n\n1. Looks up `.editorconfig` settings based on the current working directory\n2. Reads `indent_style` and `indent_size` properties\n3. Applies the configured indentation to list continuation lines and nested content\n\n### CLI Usage\n\nWhen using mdformat from the command line, the plugin looks up `.editorconfig` settings based on your **current working directory**. This means:\n\n- Run mdformat from your project root to pick up project-level `.editorconfig`\n- A global `~/.editorconfig` (with `root = true`) will apply to all mdformat calls within your home directory\n\n```bash\n# Run from project root to use project's .editorconfig\ncd /path/to/project\nmdformat docs/*.md\n```\n\n### Limitation\n\nDue to mdformat's plugin architecture, the plugin cannot determine the actual file path being formatted. Instead, it uses the current working directory for `.editorconfig` lookup. This works well for the common case of running mdformat from a project root, but may not pick up the correct settings if you format files from a different directory.\n\n### Python API\n\nWhen using the Python API directly, you can explicitly set the file context for more precise `.editorconfig` lookup:\n\n```python\nimport mdformat\nfrom mdformat_editorconfig import set_current_file\n\n# Set the file context for editorconfig lookup\nset_current_file(\"/path/to/your/file.md\")\ntry:\n    result = mdformat.text(markdown_text, extensions={\"editorconfig\"})\nfinally:\n    set_current_file(None)\n```\n\n## Scope\n\nThis plugin currently handles indentation for:\n\n- Bullet lists (unordered lists)\n- Ordered lists\n\nCode blocks and blockquotes follow CommonMark standard formatting (4-space indentation for indented code blocks).\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/jdmonaco/mdformat-editorconfig.git\ncd mdformat-editorconfig\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_editorconfig\n\n# Run tests verbosely\nuv run pytest -v\n```\n\n## License\n\nMIT - see LICENSE file for details.\n\n[ci-badge]: https://github.com/jdmonaco/mdformat-editorconfig/workflows/CI/badge.svg\n[ci-link]: https://github.com/jdmonaco/mdformat-editorconfig/actions?query=workflow%3ACI+branch%3Amain+event%3Apush\n[pypi-badge]: https://img.shields.io/pypi/v/mdformat-editorconfig.svg\n[pypi-link]: https://pypi.org/project/mdformat-editorconfig\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmonaco%2Fmdformat-editorconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdmonaco%2Fmdformat-editorconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmonaco%2Fmdformat-editorconfig/lists"}