Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Click Extra has been maintained for 5+ years, and is free to use. You can help if you 🀝 purchase business support or 🫢 sponsor the project.
Click Extra
Light Logo Dark Logo
  • Installation
  • Tutorial

Running and wrapping CLIs

  • CLI
  • Man pages
  • CLI wrapper

Building a CLI

  • Commands & groups
  • Decorators
  • Types
  • Context
  • Multicall binaries

Configuration

  • Configuration files
  • Configuration discovery
  • Configuration formats
  • Configuration schema
  • Configuration validation
  • Environment variables

Colors and output

  • Colored help
  • Themes
  • Styling
  • Layout
  • Table
  • Spinner

Runtime behavior

  • Logging
  • Execution
  • Version
  • Bug reports
  • Telemetry

Introspection and export

  • Parameters
  • Machine-readable help
  • Command tree
  • Carapace completion

Testing

  • CLI testing
  • Pytest
  • Test suites

Terminal captures

  • CLI screenshots
  • Code snippets
  • Man-page

Documenting a CLI

  • Sphinx
  • Python directives
  • MyST docstrings
  • Pygments
  • MkDocs

Comparisons

  • Typer compatibility
  • Benchmark

Contributing

  • Contribution guide
  • Downstream packaging
  • Binaries
  • Upstream
  • Code of conduct

API reference

  • click_extra package
    • click_extra.capture package
      • click_extra.capture.html module
      • click_extra.capture.presets module
      • click_extra.capture.recording module
      • click_extra.capture.screenshot module
      • click_extra.capture.snippet module
      • click_extra.capture.svg module
      • click_extra.capture.terminal module
    • click_extra.config package
      • click_extra.config.builtin module
      • click_extra.config.discovery module
      • click_extra.config.export module
      • click_extra.config.flags module
      • click_extra.config.formats module
      • click_extra.config.option module
      • click_extra.config.schema module
      • click_extra.config.subcommands module
    • click_extra.markdown package
      • click_extra.markdown.blocks module
      • click_extra.markdown.myst module
    • click_extra.sphinx package
      • click_extra.sphinx.announcement module
      • click_extra.sphinx.changelog module
      • click_extra.sphinx.click module
      • click_extra.sphinx.click_reference module
      • click_extra.sphinx.click_runner module
      • click_extra.sphinx.crosshair module
      • click_extra.sphinx.doctrees module
      • click_extra.sphinx.fail_on_warnings module
      • click_extra.sphinx.internal_links module
      • click_extra.sphinx.linkcheck module
      • click_extra.sphinx.manpages module
      • click_extra.sphinx.matrix module
      • click_extra.sphinx.mermaid module
      • click_extra.sphinx.myst_docstrings module
      • click_extra.sphinx.opengraph module
      • click_extra.sphinx.parallel module
      • click_extra.sphinx.python module
      • click_extra.sphinx.tables module
      • click_extra.sphinx.tabs module
      • click_extra.sphinx.theme_docs module
      • click_extra.sphinx.todos module
      • click_extra.sphinx.viewcode module
    • click_extra.accessibility module
    • click_extra.ansi module
    • click_extra.blocks module
    • click_extra.bug_report module
    • click_extra.carapace module
    • click_extra.cli module
    • click_extra.cli_capture module
    • click_extra.cli_prebake module
    • click_extra.cli_wrapper module
    • click_extra.color module
    • click_extra.columns module
    • click_extra.command_doc module
    • click_extra.commands module
    • click_extra.context module
    • click_extra.decorators module
    • click_extra.envvar module
    • click_extra.execution module
    • click_extra.highlight module
    • click_extra.humanize module
    • click_extra.jobs module
    • click_extra.layout module
    • click_extra.logging module
    • click_extra.logo module
    • click_extra.mkdocs module
    • click_extra.multicall module
    • click_extra.output module
    • click_extra.param_tools module
    • click_extra.parameters module
    • click_extra.prebake module
    • click_extra.progress module
    • click_extra.project module
    • click_extra.pygments module
    • click_extra.pytest module
    • click_extra.show_params module
    • click_extra.spinner module
    • click_extra.spinner_presets module
    • click_extra.styling module
    • click_extra.table module
    • click_extra.table_options module
    • click_extra.telemetry module
    • click_extra.test_suite module
    • click_extra.testing module
    • click_extra.theme module
    • click_extra.trail module
    • click_extra.tree module
    • click_extra.types module
    • click_extra.version module
    • click_extra.version_facts module
  • tests package
    • tests.mkdocs package
      • tests.mkdocs.conftest module
      • tests.mkdocs.test_mkdocs module
    • tests.sphinx package
      • tests.sphinx.conftest module
      • tests.sphinx.test_sphinx module
      • tests.sphinx.test_sphinx_announcement module
      • tests.sphinx.test_sphinx_changelog module
      • tests.sphinx.test_sphinx_click module
      • tests.sphinx.test_sphinx_click_config module
      • tests.sphinx.test_sphinx_click_tree module
      • tests.sphinx.test_sphinx_crosshair module
      • tests.sphinx.test_sphinx_doctrees module
      • tests.sphinx.test_sphinx_fail_on_warnings module
      • tests.sphinx.test_sphinx_internal_links module
      • tests.sphinx.test_sphinx_linkcheck module
      • tests.sphinx.test_sphinx_manpages module
      • tests.sphinx.test_sphinx_matrix module
      • tests.sphinx.test_sphinx_mermaid module
      • tests.sphinx.test_sphinx_myst_docstrings module
      • tests.sphinx.test_sphinx_opengraph module
      • tests.sphinx.test_sphinx_parallel module
      • tests.sphinx.test_sphinx_python module
      • tests.sphinx.test_sphinx_tables module
      • tests.sphinx.test_sphinx_tabs module
      • tests.sphinx.test_sphinx_todos module
      • tests.sphinx.test_sphinx_viewcode module
    • tests.conftest module
    • tests.tachyon_cast module
    • tests.test_accessibility module
    • tests.test_ansi module
    • tests.test_blocks module
    • tests.test_bug_report module
    • tests.test_carapace module
    • tests.test_cli_wrapper module
    • tests.test_color module
    • tests.test_command_doc module
    • tests.test_commands module
    • tests.test_config module
    • tests.test_config_discovery module
    • tests.test_config_flags module
    • tests.test_config_schema module
    • tests.test_context module
    • tests.test_docs_anchors module
    • tests.test_docs_api module
    • tests.test_docs_directives module
    • tests.test_envvar module
    • tests.test_execution module
    • tests.test_highlight module
    • tests.test_humanize module
    • tests.test_hygiene module
    • tests.test_jobs module
    • tests.test_layout module
    • tests.test_logging module
    • tests.test_logo module
    • tests.test_multicall module
    • tests.test_myst module
    • tests.test_output module
    • tests.test_parameters module
    • tests.test_prebake module
    • tests.test_progress module
    • tests.test_project module
    • tests.test_pygments module
    • tests.test_pyproject module
    • tests.test_pytest module
    • tests.test_readme module
    • tests.test_recording module
    • tests.test_screenshots module
    • tests.test_snippet module
    • tests.test_sphinx_crossrefs module
    • tests.test_spinner module
    • tests.test_styling module
    • tests.test_table module
    • tests.test_telemetry module
    • tests.test_terminal module
    • tests.test_test_suite module
    • tests.test_testing module
    • tests.test_theme module
    • tests.test_trail module
    • tests.test_tree module
    • tests.test_types module
    • tests.test_utils module
    • tests.test_version module
  • Index
  • Module Index

Project

  • Changelog
  • Todo list
  • License
  • GitHub repository
  • Funding
Back to top
View this page
Edit this page

click_extra.sphinx.internal_links moduleΒΆ

Warn about each internal link of the built HTML that leads nowhere.

Sphinx warns about a cross-reference it cannot resolve. A link it does not resolve itself, it writes as it is: the href of a raw HTML block, a fragment that names an anchor its page lost, or a link an extension builds from data, like the [docs] link of a sphinx.ext.viewcode page. Nothing tells when such a link leads to no page, or to no anchor of its page.

This module reads the HTML pages once the build is over, and logs a DEAD_LINK_WARNING for each <a href> that leads to no file, or to a fragment that the page it leads to does not define. A link that names a scheme or a host leaves the build, and a link that opens on / depends on where the site is served, so the check skips both. A page that holds the same dead link several times gets one warning for it. --fail-on-warning then fails the build.

click_extra.sphinx.internal_links.DEAD_LINK_WARNING = 'click_extra.dead_link'ΒΆ

Type of the warning logged for each internal link that leads nowhere.

Listed in suppress_warnings, it turns the check off. Listed in FAIL_ON_WARNINGS_CONFIG, it fails a build on a dead link without --fail-on-warning.

click_extra.sphinx.internal_links.dead_links(outdir)[source]ΒΆ

Return each internal link of the HTML pages under outdir that leads nowhere.

A link to a folder leads to its index.html. A fragment is checked on an HTML target only. A link that leaves outdir through .. is skipped, like an external one.

Return type:

list[tuple[str, str, str]]

Returns:

the path of the page relative to outdir, the href as the page writes it, and "page" or "anchor" for what it misses. One entry per page and href, sorted.

click_extra.sphinx.internal_links.report_dead_links(app, exception)[source]ΒΆ

Warn once about each dead internal link of the pages the build wrote.

Connected to build-finished, which fires once every page is on disk. The warning has the DEAD_LINK_WARNING type, names the page that holds the link, and points at the source of that page when the page has one: a page that an extension writes, like a sphinx.ext.viewcode page, has none. Inert after a failed build, with a builder that writes no HTML, and when suppress_warnings lists the type, which then also spares the reading of every page.

Return type:

None

click_extra.sphinx.internal_links.setup(app)[source]ΒΆ

Register the dead-link check on app.

Called from click_extra.sphinx.setup() so projects only need to list "click_extra.sphinx" in their extensions. The default priority runs the check before click_extra.sphinx.fail_on_warnings counts the warnings of the build, at priority 900.

Return type:

None

Next
click_extra.sphinx.linkcheck module
Previous
click_extra.sphinx.fail_on_warnings module
Copyright © Kevin Deldycke and contributors
Made with Furo
Last updated on 2026-11-29
On this page
  • click_extra.sphinx.internal_links module
    • DEAD_LINK_WARNING
    • dead_links()
    • report_dead_links()
    • setup()