Description
After writing all of this, this probably should have been a feature request instead...
TL;DR: Could an option be added to disable the "Multiple URLs found for" warning and just let references to silently resolve locally as before and/or have an option to resolve links with multiple URLs found to a specific page?
Description of the bug
After doing an update from 1.0.1 to 1.1.0 I started to get many warnings in the form:
Multiple URLs found for 'x.y.z': ['reference/x/y/z/#x.y.z', 'user-guide/x/y/z#x.y.z']. Make sure to use unique headings, identifiers, or Markdown anchors (see our docs).
And since we are using strict mode, this means an error and docs that won't build.
To Reproduce
The thing is we are using this pattern to try to have as much documentation as possible as part of docstrings, but still have a nice and more organized "user guide": we use some internal modules docstrings as the user guide section and then include it in the markdown documentation. For example:
$ cat docs/user-guide/formula-engine.md
# Formula Engine
::: frequenz.sdk.timeseries.formula_engine.FormulaEngine
options:
members: None
show_bases: false
show_root_full_path: false
show_source: false
::: frequenz.sdk.timeseries.formula_engine.FormulaEngine3Phase
options:
members: None
show_bases: false
show_root_full_path: false
show_source: false
And we also generate API reference documentation using some script based on what's suggested in the docs, which will create a file like:
$ cat docs/reference/frequenz/sdk/timeseries/formula_engine/index.md
::: frequenz.sdk.timeseries.formula_engine
Hence, we have the same anchor in 2 different pages.
Expected behavior
Before this upgrade all worked as more or less fine, links just being resolved locally when possible, and externally when not.
But I think things could be even improved for this use case, as before in the example above FormulaEngine
in the user guide will resolve to the user guide, but ideally it should resolve to the API reference.
-
Add an option to ignore multiple URLs for warnings.
a. Globally in
mkdocs.yaml
b. Locally in the `:: x.y.z`` blockExample:
# Formula Engine ::: frequenz.sdk.timeseries.formula_engine.FormulaEngine options: members: None show_bases: false show_root_full_path: false show_source: false disable_multiple_urls_warning: true
-
A way to tell where to resolve multiple references to a specific page. For example:
For example something like:
# Formula Engine ::: frequenz.sdk.timeseries.formula_engine.FormulaEngine options: members: None show_bases: false show_root_full_path: false show_source: false resolve_multiple_urls: "frequenz.sdk.timeseries.formula_engine.FormulaEngine": reference/frequenz/sdk/timeseries/formula_engine.md
Additional context
- Failing CI job trying to generate the docs: Fix glossary links and restrict
mkdocs-autorefs
updates frequenz-floss/frequenz-sdk-python#1043 - Link to the working documentation generated previous to the update: https://frequenz-floss.github.io/frequenz-sdk-python/v1.0-pre/
- Script generating the reference docs: https://github.com/frequenz-floss/frequenz-repo-config-python/blob/v0.x.x/src/frequenz/repo/config/mkdocs/api_pages.py#L43