You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,11 +55,34 @@ plugins:
55
55
Be advised that in case of any customization on your part you need to include the default attributes as well if you want
56
56
to keep them, as the default list will not be included automatically anymore.
57
57
58
+
If `site:` as the prefix does not work for you for any reason, you can also configure that,
59
+
e.g.
60
+
61
+
```yaml
62
+
plugins:
63
+
- site-urls:
64
+
prefix: "relative:"
65
+
```
66
+
67
+
This can also be used to interpret absolute URLs like `/example/file.png` as relative,
68
+
by setting the `prefix` to `/`.
69
+
58
70
## How it works
59
71
60
72
The plugin hooks into the [`on_page_content` event](https://www.mkdocs.org/dev-guide/plugins/#on_page_content)
61
73
and replaces all URLs in the configured attributes (by default `href`, `src` or `data`) in the rendered HTML with the corresponding site-relative URLs.
62
74
75
+
## Development
76
+
77
+
1. Create a venv & activate it, e.g. `python -m venv venv && source venv/bin/activate`
78
+
2. Install the dev requirements: `pip install -r requirements-dev.txt`
79
+
3. Install the `pre-commit` hooks: `pre-commit install`
80
+
81
+
You can run the tests with `pytest`.
82
+
83
+
To build the docs, install their dependencies as well (`pip install -r requirements-docs.txt`),
84
+
then run `mkdocs build`.
85
+
63
86
## License
64
87
65
88
This project is licensed under the MIT license, see the [LICENSE](https://github.com/OctoPrint/mkdocs-site-urls/blob/main/LICENSE) file for details.
0 commit comments