Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down