From 713e99a265e7ec71a12a2ea600321616b1952667 Mon Sep 17 00:00:00 2001 From: Aayaan Khan <186551075+Akay-74@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:38:09 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20DOCS:=20Update=20contributor=20c?= =?UTF-8?q?ode=20style=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/contributing.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 4e3e3149..917ae07c 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -16,16 +16,17 @@ Details of the port can be found in the `markdown_it/port.yaml` and in `port.yam ## Code Style -Code style is tested using [ruff](https://github.com/astral-sh/ruff), with the configuration set in `pyproject.toml`, and code formatted with [black](https://github.com/ambv/black). +[Ruff](https://github.com/astral-sh/ruff) lints and formats the code, using the configuration in `pyproject.toml`. -Installing with `markdown-it-py[code_style]` makes the [pre-commit](https://pre-commit.com/) package available, which will ensure this style is met before commits are submitted, by reformatting the code and testing for lint errors. -It can be setup by: +From the root of a local checkout, install [pre-commit](https://pre-commit.com/) from the `pre_commit` dependency group and enable the hooks. If you do not already have a virtual environment, create one with `uv venv` first: ```shell ->> cd markdown-it-py ->> pre-commit install +uv pip install --group pre_commit +uv run --no-project pre-commit install ``` +To run the hooks on all files without committing, use `uv run --no-project pre-commit run --all-files`. + Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard. All functions and class methods should be annotated with types and include a docstring.