mdformat-ruff


Namemdformat-ruff JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/Freed-Wu/mdformat-ruff
SummaryMdformat plugin to ruffen Python code blocks
upload_time2024-02-11 01:03:58
maintainer
docs_urlNone
authorWu Zhenyu
requires_python>=3.7,<4.0
licenseMIT
keywords mdformat markdown commonmark formatter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mdformat-ruff

[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Freed-Wu/mdformat-ruff/main.svg)](https://results.pre-commit.ci/latest/github/Freed-Wu/mdformat-ruff/main)
[![github/workflow](https://github.com/Freed-Wu/mdformat-ruff/actions/workflows/main.yml/badge.svg)](https://github.com/Freed-Wu/mdformat-ruff/actions)

[![github/downloads](https://shields.io/github/downloads/Freed-Wu/mdformat-ruff/total)](https://github.com/Freed-Wu/mdformat-ruff/releases)
[![github/downloads/latest](https://shields.io/github/downloads/Freed-Wu/mdformat-ruff/latest/total)](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)
[![github/issues](https://shields.io/github/issues/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/issues)
[![github/issues-closed](https://shields.io/github/issues-closed/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/issues?q=is%3Aissue+is%3Aclosed)
[![github/issues-pr](https://shields.io/github/issues-pr/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/pulls)
[![github/issues-pr-closed](https://shields.io/github/issues-pr-closed/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/pulls?q=is%3Apr+is%3Aclosed)
[![github/discussions](https://shields.io/github/discussions/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/discussions)
[![github/milestones](https://shields.io/github/milestones/all/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/milestones)
[![github/forks](https://shields.io/github/forks/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/network/members)
[![github/stars](https://shields.io/github/stars/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/stargazers)
[![github/watchers](https://shields.io/github/watchers/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/watchers)
[![github/contributors](https://shields.io/github/contributors/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/graphs/contributors)
[![github/commit-activity](https://shields.io/github/commit-activity/w/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/graphs/commit-activity)
[![github/last-commit](https://shields.io/github/last-commit/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/commits)
[![github/release-date](https://shields.io/github/release-date/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)

[![github/license](https://shields.io/github/license/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/blob/main/LICENSE)
[![github/languages](https://shields.io/github/languages/count/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)
[![github/languages/top](https://shields.io/github/languages/top/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)
[![github/directory-file-count](https://shields.io/github/directory-file-count/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)
[![github/code-size](https://shields.io/github/languages/code-size/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)
[![github/repo-size](https://shields.io/github/repo-size/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)
[![github/v](https://shields.io/github/v/release/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)

[![pypi/status](https://shields.io/pypi/status/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#description)
[![pypi/v](https://shields.io/pypi/v/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#history)
[![pypi/downloads](https://shields.io/pypi/dd/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)
[![pypi/format](https://shields.io/pypi/format/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)
[![pypi/implementation](https://shields.io/pypi/implementation/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)
[![pypi/pyversions](https://shields.io/pypi/pyversions/mdformat-ruff)](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[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Freed-Wu/mdformat-ruff/main.svg)](https://results.pre-commit.ci/latest/github/Freed-Wu/mdformat-ruff/main)\n[![github/workflow](https://github.com/Freed-Wu/mdformat-ruff/actions/workflows/main.yml/badge.svg)](https://github.com/Freed-Wu/mdformat-ruff/actions)\n\n[![github/downloads](https://shields.io/github/downloads/Freed-Wu/mdformat-ruff/total)](https://github.com/Freed-Wu/mdformat-ruff/releases)\n[![github/downloads/latest](https://shields.io/github/downloads/Freed-Wu/mdformat-ruff/latest/total)](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)\n[![github/issues](https://shields.io/github/issues/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/issues)\n[![github/issues-closed](https://shields.io/github/issues-closed/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/issues?q=is%3Aissue+is%3Aclosed)\n[![github/issues-pr](https://shields.io/github/issues-pr/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/pulls)\n[![github/issues-pr-closed](https://shields.io/github/issues-pr-closed/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/pulls?q=is%3Apr+is%3Aclosed)\n[![github/discussions](https://shields.io/github/discussions/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/discussions)\n[![github/milestones](https://shields.io/github/milestones/all/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/milestones)\n[![github/forks](https://shields.io/github/forks/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/network/members)\n[![github/stars](https://shields.io/github/stars/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/stargazers)\n[![github/watchers](https://shields.io/github/watchers/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/watchers)\n[![github/contributors](https://shields.io/github/contributors/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/graphs/contributors)\n[![github/commit-activity](https://shields.io/github/commit-activity/w/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/graphs/commit-activity)\n[![github/last-commit](https://shields.io/github/last-commit/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/commits)\n[![github/release-date](https://shields.io/github/release-date/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/releases/latest)\n\n[![github/license](https://shields.io/github/license/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff/blob/main/LICENSE)\n[![github/languages](https://shields.io/github/languages/count/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n[![github/languages/top](https://shields.io/github/languages/top/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n[![github/directory-file-count](https://shields.io/github/directory-file-count/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n[![github/code-size](https://shields.io/github/languages/code-size/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n[![github/repo-size](https://shields.io/github/repo-size/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n[![github/v](https://shields.io/github/v/release/Freed-Wu/mdformat-ruff)](https://github.com/Freed-Wu/mdformat-ruff)\n\n[![pypi/status](https://shields.io/pypi/status/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#description)\n[![pypi/v](https://shields.io/pypi/v/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#history)\n[![pypi/downloads](https://shields.io/pypi/dd/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)\n[![pypi/format](https://shields.io/pypi/format/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)\n[![pypi/implementation](https://shields.io/pypi/implementation/mdformat-ruff)](https://pypi.org/project/mdformat-ruff/#files)\n[![pypi/pyversions](https://shields.io/pypi/pyversions/mdformat-ruff)](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"
}
        
Elapsed time: 2.72270s