tests.test_docs_anchors module

Every Markdown fragment link resolves in a raw-Markdown reader.

Three slug algorithms compete over the same headings. docutils.nodes.make_id derives the ids Sphinx renders, and myst_heading_slug_func in docs/conf.py points MyST at it, so a link written parameters.md#params-option is correct on the published site. GitHub, and the lychee checker that models it, slug the raw Markdown instead. They keep the leading -- and the underscores that make_id strips or folds, drop a dot where it writes a hyphen, and write one hyphen per space where it writes one per run. The same link thus finds nothing when the page is read on GitHub.

Neither reader can be dropped, so a heading whose two slugs disagree carries an <a name="…"> companion holding the make_id spelling. That HTML anchor is invisible to Sphinx (it renders no id, so the page keeps one id per section) and authoritative for GitHub and lychee.

Docstrings take a third path to the site. click_extra.sphinx.myst_docstrings passes their link targets to reST unchanged. A page.md#anchor target, which myst-parser resolves in a page, thus ships as written, and the site serves no .md file. So a docstring links a page with :doc: and a section with :ref:.

The check runs on text alone: no build, no network, no platform floor. Its counterpart on the built HTML is test_sphinx_crossrefs.py, which is skipped off Linux, and the check-broken-links CI job, which files an issue instead of failing a run. Both let a broken anchor sit for a full cycle.

tests.test_docs_anchors.lychee_excludes()[source]

Read the link patterns [tool.lychee] waives, so both checkers agree.

The palette anchors of docs/theme.md are the ones that matter here: a {python:render} loop emits their headings at build time, so no reader of the raw Markdown can see them.

Return type:

tuple[Pattern[str], ...]

tests.test_docs_anchors.closes_fence(marker, opening)[source]

Tell whether a line’s fence marker closes the block opening started.

Return type:

bool

tests.test_docs_anchors.uncoded_lines(content, keep_directive_bodies=False)[source]

Number and return the lines sitting outside a code fence.

lychee ignores fenced content, so a link in an example is not a link. The docstring converter renders the body of a directive fence like :note:, so keep_directive_bodies returns those lines, without the fence markers.

Return type:

list[tuple[int, str]]

tests.test_docs_anchors.uncoded_spans(line)[source]

Drop a line’s code spans, so a link or anchor quoted in prose is not read.

Headings are slugged from the raw line instead: GitHub keeps the text of a code span in a heading’s slug.

Return type:

str

tests.test_docs_anchors.github_slug(heading)[source]

Slug a heading the way GitHub does, which is what lychee models.

Lowercase, drop every character that is neither a word character, a space nor a hyphen, then replace each space with a hyphen. Backticks vanish with the rest of the punctuation, so a leading -- and an underscore survive, and a dot goes with no separator. Each space gives its own hyphen: a / dropped from between two spaces leaves --, where make_id writes one -.

Return type:

str

tests.test_docs_anchors.readable_anchors(path)[source]

Collect every fragment a raw-Markdown reader can reach on a page.

Duplicate heading slugs are numbered the way GitHub numbers them, so a heading repeated three times answers to slug, slug-1 and slug-2.

Return type:

set[str]

tests.test_docs_anchors.unresolved_fragments(paths=(PosixPath('/home/runner/work/click-extra/click-extra/AGENTS.md'), PosixPath('/home/runner/work/click-extra/click-extra/changelog.md'), PosixPath('/home/runner/work/click-extra/click-extra/readme.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/benchmark.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/binaries.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/bug-report.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/carapace.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/changelog.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/cli.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.accessibility.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.ansi.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.blocks.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.bug_report.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.html.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.presets.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.recording.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.screenshot.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.snippet.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.svg.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.capture.terminal.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.carapace.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.cli.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.cli_capture.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.cli_prebake.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.cli_wrapper.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.color.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.columns.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.command_doc.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.commands.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.builtin.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.discovery.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.export.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.flags.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.formats.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.option.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.schema.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.config.subcommands.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.context.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.decorators.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.envvar.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.execution.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.highlight.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.humanize.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.jobs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.layout.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.logging.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.logo.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.markdown.blocks.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.markdown.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.markdown.myst.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.mkdocs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.multicall.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.output.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.param_tools.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.parameters.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.prebake.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.progress.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.project.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.pygments.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.pytest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.show_params.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.announcement.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.changelog.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.click.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.click_reference.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.click_runner.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.crosshair.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.doctrees.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.fail_on_warnings.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.linkcheck.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.manpages.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.matrix.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.mermaid.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.myst_docstrings.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.opengraph.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.python.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.tables.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.tabs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.theme_docs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.todos.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.sphinx.viewcode.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.spinner.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.spinner_presets.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.styling.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.table.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.table_options.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.telemetry.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.test_suite.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.testing.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.theme.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.trail.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.tree.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.types.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.version.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/click_extra.version_facts.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/code-of-conduct.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/colorize.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/commands.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/config-discovery.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/config-formats.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/config-schema.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/config-validation.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/config.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/context.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/contributing.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/decorators.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/envvar.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/execution.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/index.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/install.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/layout.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/license.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/logging.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/machine-readable.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/man-page.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/man.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/mkdocs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/multicall.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/myst-docstrings.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/packaging.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/parameters.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/pygments.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/pytest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/python-directives.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/screenshots.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/snippets.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/sphinx.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/spinner.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/styling.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/table.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/telemetry.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/test-suite.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/testing.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.conftest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.mkdocs.conftest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.mkdocs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.mkdocs.test_mkdocs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.conftest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_announcement.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_changelog.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_click.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_click_config.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_click_tree.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_crosshair.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_doctrees.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_fail_on_warnings.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_linkcheck.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_manpages.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_matrix.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_mermaid.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_myst_docstrings.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_opengraph.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_python.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_tables.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_tabs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_todos.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.sphinx.test_sphinx_viewcode.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.tachyon_cast.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_accessibility.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_ansi.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_blocks.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_bug_report.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_carapace.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_cli_wrapper.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_color.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_command_doc.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_commands.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_config.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_config_discovery.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_config_flags.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_config_schema.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_context.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_docs_anchors.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_docs_api.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_docs_directives.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_envvar.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_execution.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_highlight.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_humanize.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_hygiene.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_jobs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_layout.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_logging.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_logo.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_multicall.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_myst.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_output.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_parameters.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_prebake.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_progress.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_project.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_pygments.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_pyproject.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_pytest.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_readme.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_recording.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_screenshots.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_snippet.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_sphinx_crossrefs.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_spinner.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_styling.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_table.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_telemetry.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_terminal.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_test_suite.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_testing.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_theme.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_trail.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_tree.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_types.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_utils.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tests.test_version.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/theme.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/todolist.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tree.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/tutorial.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/typer.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/types.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/upstream.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/version.md'), PosixPath('/home/runner/work/click-extra/click-extra/docs/wrap.md')))[source]

Report every fragment link no raw-Markdown reader can follow.

Each entry names the source location, the target and the fragment, so the failure says where to add the missing <a name="…">.

Return type:

list[str]

tests.test_docs_anchors.rendered_prose(path)[source]

Collect the prose autodoc renders from a module, with the line it starts on.

Every bare string statement counts, so attribute docstrings join the module, class and function ones, and so does every #: comment. A docstring loses its indentation after the first line, so a fence opens at the margin as it does in a page.

Return type:

list[tuple[int, str]]

Report every docstring link that names a page by its .md file.

Return type:

list[tuple[Path, int, str]]

tests.test_docs_anchors.test_markdown_files_are_collected()[source]

The glob feeding the check still finds the documentation.

No fragment link dangles for a reader of the raw Markdown.

A failure means the target heading slugs differently on GitHub than make_id spells it. Add <a name="{fragment}"></a> above that heading, rather than rewording the link: the make_id spelling is what the built site renders.

tests.test_docs_anchors.test_github_slug(heading, expected)[source]

The slugger reproduces the spellings that diverge from make_id.

Every case is a heading of this documentation whose two slugs disagree, which is what makes its <a name="…"> companion necessary.

tests.test_docs_anchors.test_uncoded_spans(line, expected)[source]

A span goes whatever its backtick count, and a lone backtick stays.

A link or an anchor quoted in a code span is prose, as lychee reads it.

tests.test_docs_anchors.test_package_sources_are_collected()[source]

The glob feeding the docstring check still finds the package.

No docstring links a documentation page by its .md file.

A failure names a link that ships dead. Link the page with :doc:, or its section with :ref: after adding a (label)= target above the heading.

The scan reads every docstring autodoc renders, and only their prose.