diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 714d5dd9a1..6aeafc3c29 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-python@v4 - name: "Install dependencies" run: | - pip install "mkdocs~=1.4.2" "mkdocs-material~=9.0.6" + pip install -r docs/requirements.txt - name: "Copy README File" run: | python scripts/transform_readme.py --target mkdocs diff --git a/.gitignore b/.gitignore index f13c7d56b0..066fb2306e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ crates/ruff/resources/test/cpython docs/* !docs/rules !docs/assets +!docs/requirements.txt mkdocs.yml .overrides diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7809ee0fb..f73c4c9731 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -170,6 +170,26 @@ lives in `crates/ruff/src/flake8_to_ruff/converter.rs`. Finally, regenerate the documentation and generated code with `cargo dev generate-all`. +## MkDocs + +To preview any changes to the documentation locally: + +1. Install MkDocs and Material for MkDocs with: + ```shell + pip install -r docs/requirements.txt + ``` +2. Generate the MkDocs site with: + ```shell + python scripts/generate_mkdocs.py + ``` +3. Run the development server with: + ```shell + mkdocs serve + ``` + +The documentation should then be available locally at +[http://127.0.0.1:8000/docs/](http://127.0.0.1:8000/docs/). + ## Release process As of now, Ruff has an ad hoc release process: releases are cut with high frequency via GitHub diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000000..b5b1417243 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +mkdocs~=1.4.2 +mkdocs-material~=9.0.6 +PyYAML~=6.0