Skip to content

bug: "regression" in 1.1.0 regarding "Multiple URLs found for" #52

Closed
@llucax

Description

@llucax

Warning

This report might look like:

Workflow

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.

  1. Add an option to ignore multiple URLs for warnings.

    a. Globally in mkdocs.yaml
    b. Locally in the `:: x.y.z`` block

    Example:

    # 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
  2. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions