trlcdoc.sphinx_links ==================== .. py:module:: trlcdoc.sphinx_links .. autoapi-nested-parse:: Sphinx extension resolving the relative links and images of Markdown pages against the project. A Markdown document is copied into the Sphinx source folder, so its relative links and images would point into that folder instead of the project. This extension resolves them against the location of the Markdown file in the project: - an image is taken from the project, Sphinx copies it into the site - a link to a file of a site page links to that page - a link to any other project file or folder links to the repository at the built commit - without a repository, such a link is shown as text with a warning Links to targets which do not exist in the project are left to MyST, which reports them. The settings are provided by trlcdoc in the configuration value 'trlcdoc_links'. Attributes ---------- .. autoapisummary:: trlcdoc.sphinx_links.LOGGER trlcdoc.sphinx_links.CONFIG_NAME trlcdoc.sphinx_links.URL_SCHEME Classes ------- .. autoapisummary:: trlcdoc.sphinx_links.MarkdownImages trlcdoc.sphinx_links.MarkdownLinks Functions --------- .. autoapisummary:: trlcdoc.sphinx_links.setup Module Contents --------------- .. py:data:: LOGGER .. py:data:: CONFIG_NAME :value: 'trlcdoc_links' .. py:data:: URL_SCHEME .. py:class:: MarkdownImages(document, startnode=None) Bases: :py:obj:`sphinx.transforms.SphinxTransform` .. autoapi-inheritance-diagram:: trlcdoc.sphinx_links.MarkdownImages :parts: 1 Take the relative images of Markdown pages from the project, while the page is read. .. py:attribute:: default_priority :value: 400 Numerical priority of this transform, 0 through 999 (override). .. py:method:: apply(**kwargs: Any) -> None Replace the image paths of a Markdown page by the paths of the project files. :param \*\*kwargs: Unused transform arguments. :type \*\*kwargs: Any .. py:class:: MarkdownLinks(document, startnode=None) Bases: :py:obj:`sphinx.transforms.post_transforms.SphinxPostTransform` .. autoapi-inheritance-diagram:: trlcdoc.sphinx_links.MarkdownLinks :parts: 1 Resolve the relative links of Markdown pages, which MyST could not resolve in the Sphinx source folder. .. py:attribute:: default_priority :value: 8 Numerical priority of this transform, 0 through 999 (override). .. py:method:: run(**kwargs: Any) -> None Replace the unresolved links to project files by page links, repository links or text. :param \*\*kwargs: Unused transform arguments. :type \*\*kwargs: Any .. py:function:: setup(app: sphinx.application.Sphinx) -> dict[str, Any] Register the configuration value and the transforms. :param app: The Sphinx application. :type app: Sphinx :returns: The extension metadata. :rtype: dict[str, Any]