Skip to content

Commit

Permalink
docs: Works with sphinx.ext.extlink
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Jan 12, 2024
1 parent 1d33d92 commit f0794eb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
'plain_literal': (['literal'], False),
'parsed_literal': (['literal'], True),
'parsed_emphasis': (['emphasis'], True),
'literal_issue': ['literal', 'issue'],
}

# DOG FOOD CONFIGURATION END
Expand Down
36 changes: 36 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,42 @@ be parsed too:

.. note:: For nested roles, note that the backquote ````` needs to be escaped.

Works with other Extensions
===========================

The extensions can also work with roles provided by the some other extensions
(not all, see :ref:`limitation`).

``sphinx.ext.extlink``
----------------------

:parsed_literal:`sphinx.ext.extlink_` is a Sphinx builtin extension to create
shorten external links.

Assume that we have the following configuration, extlink creates the ``issue`` role,
then comboroles creates a ``literal_issue`` role based on it:

.. code:: python
extlinks = {
'issue': ('https://github.com/sphinx-notes/comboroles/issues/%s', '💬%s'),
}
comboroles_roles = {
'literal_issue': ['literal', 'issue'],
}
========================== ====================
``:issue:`new``` :issue:`new`
``:literal_issue:`new```` :literal_issue:`new`
========================== ====================

.. seealso:: https://github.com/sphinx-doc/sphinx/issues/11745

.. _sphinx.ext.extlinks: https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html

.. _limitation:

Limitation
==========

Expand Down

0 comments on commit f0794eb

Please sign in to comment.