# mdformat-ruff
[](https://results.pre-commit.ci/latest/github/Freed-Wu/mdformat-ruff/main)
[](https://github.com/Freed-Wu/mdformat-ruff/actions)
[](https://github.com/Freed-Wu/mdformat-ruff/releases)
[](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)
[](https://github.com/Freed-Wu/mdformat-ruff/issues)
[](https://github.com/Freed-Wu/mdformat-ruff/issues?q=is%3Aissue+is%3Aclosed)
[](https://github.com/Freed-Wu/mdformat-ruff/pulls)
[](https://github.com/Freed-Wu/mdformat-ruff/pulls?q=is%3Apr+is%3Aclosed)
[](https://github.com/Freed-Wu/mdformat-ruff/discussions)
[](https://github.com/Freed-Wu/mdformat-ruff/milestones)
[](https://github.com/Freed-Wu/mdformat-ruff/network/members)
[](https://github.com/Freed-Wu/mdformat-ruff/stargazers)
[](https://github.com/Freed-Wu/mdformat-ruff/watchers)
[](https://github.com/Freed-Wu/mdformat-ruff/graphs/contributors)
[](https://github.com/Freed-Wu/mdformat-ruff/graphs/commit-activity)
[](https://github.com/Freed-Wu/mdformat-ruff/commits)
[](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)
[](https://github.com/Freed-Wu/mdformat-ruff/blob/main/LICENSE)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://github.com/Freed-Wu/mdformat-ruff)
[](https://pypi.org/project/mdformat-ruff/#description)
[](https://pypi.org/project/mdformat-ruff/#history)
[](https://pypi.org/project/mdformat-ruff/#files)
[](https://pypi.org/project/mdformat-ruff/#files)
[](https://pypi.org/project/mdformat-ruff/#files)
[](https://pypi.org/project/mdformat-ruff/#files)
> Mdformat plugin to ruffen Python code blocks
## Description
mdformat-ruff is an [mdformat](https://github.com/executablebooks/mdformat) plugin
that makes mdformat format Python code blocks with [ruff](https://github.com/psf/ruff).
## Usage
Install with:
```bash
pip install mdformat-ruff
```
You may pin ruff dependency for formatting stability:
```bash
pip install mdformat-ruff ruff==22.1.0
```
When using mdformat on the command line, ruff formatting will be automatically
enabled after install.
When using mdformat Python API, code formatting for Python will have to be
enabled explicitly:
````python
import mdformat
unformatted = "```python\n'''ruff converts quotes'''\n```\n"
formatted = mdformat.text(unformatted, codeformatters={"python"})
assert formatted == '```python\n"""ruff converts quotes"""\n```\n'
````
## Usage as a [pre-commit](https://pre-commit.com) hook
Add the following to your `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.13 # Use the ref you want to point at
hooks:
- id: mdformat
additional_dependencies:
- mdformat-ruff
- ruff==22.1.0 # Pinning ruff here is optional
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Freed-Wu/mdformat-ruff",
"name": "mdformat-ruff",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "mdformat,markdown,commonmark,formatter",
"author": "Wu Zhenyu",
"author_email": "wuzhenyu@ustc.edu",
"download_url": "https://files.pythonhosted.org/packages/3a/e2/9003dc57c78aea34b21f67854d842985ceac48028d288432efa113df3887/mdformat_ruff-0.1.3.tar.gz",
"platform": null,
"description": "# mdformat-ruff\n\n[](https://results.pre-commit.ci/latest/github/Freed-Wu/mdformat-ruff/main)\n[](https://github.com/Freed-Wu/mdformat-ruff/actions)\n\n[](https://github.com/Freed-Wu/mdformat-ruff/releases)\n[](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)\n[](https://github.com/Freed-Wu/mdformat-ruff/issues)\n[](https://github.com/Freed-Wu/mdformat-ruff/issues?q=is%3Aissue+is%3Aclosed)\n[](https://github.com/Freed-Wu/mdformat-ruff/pulls)\n[](https://github.com/Freed-Wu/mdformat-ruff/pulls?q=is%3Apr+is%3Aclosed)\n[](https://github.com/Freed-Wu/mdformat-ruff/discussions)\n[](https://github.com/Freed-Wu/mdformat-ruff/milestones)\n[](https://github.com/Freed-Wu/mdformat-ruff/network/members)\n[](https://github.com/Freed-Wu/mdformat-ruff/stargazers)\n[](https://github.com/Freed-Wu/mdformat-ruff/watchers)\n[](https://github.com/Freed-Wu/mdformat-ruff/graphs/contributors)\n[](https://github.com/Freed-Wu/mdformat-ruff/graphs/commit-activity)\n[](https://github.com/Freed-Wu/mdformat-ruff/commits)\n[](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)\n\n[](https://github.com/Freed-Wu/mdformat-ruff/blob/main/LICENSE)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n[](https://github.com/Freed-Wu/mdformat-ruff)\n\n[](https://pypi.org/project/mdformat-ruff/#description)\n[](https://pypi.org/project/mdformat-ruff/#history)\n[](https://pypi.org/project/mdformat-ruff/#files)\n[](https://pypi.org/project/mdformat-ruff/#files)\n[](https://pypi.org/project/mdformat-ruff/#files)\n[](https://pypi.org/project/mdformat-ruff/#files)\n\n> Mdformat plugin to ruffen Python code blocks\n\n## Description\n\nmdformat-ruff is an [mdformat](https://github.com/executablebooks/mdformat) plugin\nthat makes mdformat format Python code blocks with [ruff](https://github.com/psf/ruff).\n\n## Usage\n\nInstall with:\n\n```bash\npip install mdformat-ruff\n```\n\nYou may pin ruff dependency for formatting stability:\n\n```bash\npip install mdformat-ruff ruff==22.1.0\n```\n\nWhen using mdformat on the command line, ruff formatting will be automatically\nenabled after install.\n\nWhen using mdformat Python API, code formatting for Python will have to be\nenabled explicitly:\n\n````python\nimport mdformat\n\nunformatted = \"```python\\n'''ruff converts quotes'''\\n```\\n\"\nformatted = mdformat.text(unformatted, codeformatters={\"python\"})\nassert formatted == '```python\\n\"\"\"ruff converts quotes\"\"\"\\n```\\n'\n````\n\n## Usage as a [pre-commit](https://pre-commit.com) hook\n\nAdd the following to your `.pre-commit-config.yaml`:\n\n```yaml\n - repo: https://github.com/executablebooks/mdformat\n rev: 0.7.13 # Use the ref you want to point at\n hooks:\n - id: mdformat\n additional_dependencies:\n - mdformat-ruff\n - ruff==22.1.0 # Pinning ruff here is optional\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mdformat plugin to ruffen Python code blocks",
"version": "0.1.3",
"project_urls": {
"Bug Report": "https://github.com/Freed-Wu/mdformat-ruff/issues",
"Download": "https://github.com/Freed-Wu/mdformat-ruff/releases",
"Homepage": "https://mdformat-ruff.readthedocs.io",
"Repository": "https://github.com/Freed-Wu/mdformat-ruff",
"Source": "https://github.com/Freed-Wu/mdformat-ruff"
},
"split_keywords": [
"mdformat",
"markdown",
"commonmark",
"formatter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b1223f2464d478f145bbcb731cee9fe720b9e4d69efb6ffd8bc4491f14ca20a2",
"md5": "704263346a7f761c992f7ef082ec453a",
"sha256": "9c0cf7bfe6bf99b9e0e617e960041d06e9fa84300d5645f922306dd2ed0d1296"
},
"downloads": -1,
"filename": "mdformat_ruff-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "704263346a7f761c992f7ef082ec453a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 3932,
"upload_time": "2024-02-11T01:03:57",
"upload_time_iso_8601": "2024-02-11T01:03:57.010056Z",
"url": "https://files.pythonhosted.org/packages/b1/22/3f2464d478f145bbcb731cee9fe720b9e4d69efb6ffd8bc4491f14ca20a2/mdformat_ruff-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3ae29003dc57c78aea34b21f67854d842985ceac48028d288432efa113df3887",
"md5": "6eb875a3e0924ebdd22e0fc3448e8299",
"sha256": "2ddd2758dd3f6738c1c7bfbeb89320d271454f4cd8c28a99968a50d3578b15d6"
},
"downloads": -1,
"filename": "mdformat_ruff-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "6eb875a3e0924ebdd22e0fc3448e8299",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 3416,
"upload_time": "2024-02-11T01:03:58",
"upload_time_iso_8601": "2024-02-11T01:03:58.143481Z",
"url": "https://files.pythonhosted.org/packages/3a/e2/9003dc57c78aea34b21f67854d842985ceac48028d288432efa113df3887/mdformat_ruff-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-11 01:03:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Freed-Wu",
"github_project": "mdformat-ruff",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mdformat-ruff"
}