sphinx_linkfix.extension ======================== .. py:module:: sphinx_linkfix.extension .. autoapi-nested-parse:: Sphinx extension to rewrite internal links in reStructuredText files. Classes ------- .. autoapisummary:: sphinx_linkfix.extension.RstLinkRewriter Functions --------- .. autoapisummary:: sphinx_linkfix.extension._is_external sphinx_linkfix.extension._strip_prefixes sphinx_linkfix.extension.setup Module Contents --------------- .. py:class:: RstLinkRewriter(document, startnode=None) Bases: :py:obj:`sphinx.transforms.post_transforms.SphinxPostTransform` Post- transform to rewrite internal links in reStructuredText files. .. py:method:: _sanitize_fragment_for_latex(fragment: str) -> str Sanitize a fragment for LaTeX compatibility. :param fragment: The fragment to sanitize. :type fragment: str :returns: The sanitized fragment. :rtype: str .. py:method:: run() -> None Rewrite internal links in the document. .. py:attribute:: default_priority :value: 999 Numerical priority of this transform, 0 through 999 (override). .. py:function:: _is_external(href: str) -> bool Check if a given href is an external link. :param href: The URL to check. :type href: str :returns: True if the URL is external, False otherwise. :rtype: bool .. py:function:: _strip_prefixes(path_str: str, prefixes: tuple[str, Ellipsis]) -> str Remove leading folder prefixes from a path string. :param path_str: The path string to modify. :type path_str: str :param prefixes: A tuple of prefixes to remove. :type prefixes: tuple[str, ...] :returns: The modified path string with the prefixes removed. :rtype: str .. py:function:: setup(app: Any) -> dict[str, str | bool] Set up the Sphinx extension. :param app: The Sphinx application object. :type app: Any :returns: A dictionary with extension metadata. :rtype: dict[str, str | bool]