Fix mkdocs autoref links to use reference-style syntax - #184
Fix mkdocs autoref links to use reference-style syntax#184Mustaphayinka wants to merge 2 commits into
Conversation
|
Nice, thank you @Mustaphayinka. For acceptance testing, would you be able to confirm that the new links bring us to the desired targets? I would usually ask for a screenshot for docs related updates but I realize that might not be the most appropriate for checking link targets. As an aside - I wonder if there is a GitHub actions workflow we can set up to check for broken links in the docs and make sure they all resolve. Maybe we can create a new issue to add that check! I see the CI build is currently failing, but due to line too long errors. We can try adding a pylint disable comment (on the tail / closing end of the docstring triple quotes should work I believe). |
|
Fixed both issues: corrected line-too-long errors by wrapping each affected docstring with scoped pylint disable/enable comments. For acceptance testing, I built the documentation locally with mkdocs build and inspected the generated HTML directly. The autorefs links now resolve as expected, with class="autorefs autorefs-internal" and matching href/anchor pairs; I did not rely on screenshots of a browser session. This also exposed and allowed me to fix a genuine case-mismatch bug: the docstring for calculateifainv linked to netradiativeheatfluxfunctionofT with a capital T, while the actual function is netradiativeheatfluxfunctionoft with a lowercase t. Once the syntax was corrected, autorefs properly identified the link as an unresolved cross-reference something the previously broken syntax had been masking. |
Fixes #107
In dataset.py, partition.py, and buildingradiationutils.py, the docstrings used standard Markdown relative links (text). MkDocs’ link resolver could not interpret them, which produced the “unrecognized relative link” warning mentioned in the issue. They still resolved through mkdocstrings/autorefs, but only incidentally.
Changed all 23 instances to reference-style links ([text][anchor]), the syntax autorefs is designed to intercept and resolve against the anchors generated by mkdocstrings. This should suppress the warning and allow the links to resolve reliably instead of working around a bug in the resolution path and also verified no remaining instances of the old pattern across all three affected files.