summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoris Roovers <joris.roovers@gmail.com>2023-05-15 10:11:26 +0200
committerGitHub <noreply@github.com>2023-05-15 10:11:26 +0200
commit66601ba560de6660621568a584cb36f65e1364c5 (patch)
treed60a3eb986aa454987ad183d14356dc40a6e88ae
parent5a1cd61cbdc57e0afc0fc90d4690eb8a9296d85e (diff)
Mike for docs versioning (#496)
Using mike together with Material for Mkdocs to manage multiple versions of the docs.
-rw-r--r--docs/contributing/tests_formatting_docs.md5
-rw-r--r--docs/javascript/extra.js2
-rw-r--r--mkdocs.yml5
-rw-r--r--pyproject.toml4
4 files changed, 11 insertions, 5 deletions
diff --git a/docs/contributing/tests_formatting_docs.md b/docs/contributing/tests_formatting_docs.md
index 62a2eab..6d3227c 100644
--- a/docs/contributing/tests_formatting_docs.md
+++ b/docs/contributing/tests_formatting_docs.md
@@ -60,8 +60,8 @@ hatch run test:autofix
```
## Documentation
-We use [mkdocs](https://www.mkdocs.org/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for
-generating our documentation from markdown.
+We use [mkdocs](https://www.mkdocs.org/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) and
+[mike](https://github.com/jimporter/mike) for generating our documentation from markdown.
To use it:
```{.sh .copy}
@@ -70,7 +70,6 @@ hatch run docs:serve
Then access the documentation website on [http://localhost:8000]().
-
## Tools
We keep a small set of scripts in the `tools/` directory:
diff --git a/docs/javascript/extra.js b/docs/javascript/extra.js
index 74e32c7..076f7e4 100644
--- a/docs/javascript/extra.js
+++ b/docs/javascript/extra.js
@@ -7,7 +7,7 @@ document.addEventListener("DOMContentLoaded", function () {
// This is to support old links that are in gitlint's CLI Output
// If the trailing slash is missing from /gitlint/configuration, mkdocs will redirect to the trailing slash version,
// and then this code will redirect to the correct page
- if (window.location.pathname == "/gitlint/configuration/") {
+ if (window.location.pathname.endsWith("configuration/")) {
if (window.location.hash === "#regex-style-search") {
window.location.href = "/gitlint/configuration/general_options/#regex-style-search";
} else if (window.location.hash === "#staged") {
diff --git a/mkdocs.yml b/mkdocs.yml
index 61e45c8..f2074ab 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -38,6 +38,9 @@ plugins:
# URLs present in the generated .gitlint file
contrib_rules.md : rules/contrib_rules.md
user_defined_rules.md : rules/user_defined_rules/index.md
+ mike:
+ alias_type: copy
+ canonical_version: latest
theme:
name: material
@@ -91,6 +94,8 @@ extra:
- icon: simple/twitter
link: https://twitter.com/jorisroovers
name: Joris Roovers on twitter
+ version:
+ provider: mike
nav:
- Home:
diff --git a/pyproject.toml b/pyproject.toml
index 9b12d35..162d3ad 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -150,11 +150,13 @@ detached = true
dependencies = [
"mkdocs-material==9.1.9", #
"mkdocs-redirects==1.2.0",
+ # https://github.com/jimporter/mike/issues/130
+ "mike @ https://github.com/jimporter/mike/archive/300593c338b18f61f604d18457c351e166318020.zip",
]
[tool.hatch.envs.docs.scripts]
build = "mkdocs build --clean --strict"
-serve = "mkdocs serve"
+serve = "mike serve"
# Tool config ##########################################################################################################