use sphinx extlinks instead of custon roles
This commit is contained in:
parent
1f4372b34c
commit
f9cfb6f989
27
docs/conf.py
27
docs/conf.py
@ -59,6 +59,7 @@ extensions = [
|
||||
'sphinx.ext.ifconfig',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.githubpages',
|
||||
'sphinx.ext.extlinks',
|
||||
'sphinx_copybutton',
|
||||
'sphinx_inline_tabs',
|
||||
"sphinxext.opengraph",
|
||||
@ -167,24 +168,11 @@ texinfo_documents = [
|
||||
|
||||
# GitHub linking inline roles {{{
|
||||
|
||||
def num_role(
|
||||
which: str, name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
|
||||
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
|
||||
' Link to a github issue '
|
||||
try:
|
||||
issue_num = int(text)
|
||||
if issue_num <= 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
msg = inliner.reporter.error(
|
||||
'GitHub issue number must be a number greater than or equal to 1; '
|
||||
'"%s" is invalid.' % text, line=lineno)
|
||||
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||
return [prb], [msg]
|
||||
url = f'https://github.com/kovidgoyal/kitty/{which}/{issue_num}'
|
||||
set_classes(options)
|
||||
node = nodes.reference(rawtext, f'#{issue_num}', refuri=url, **options)
|
||||
return [node], []
|
||||
extlinks = {
|
||||
'iss': ('https://github.com/kovidgoyal/kitty/issues/%s', '#%s'),
|
||||
'pull': ('https://github.com/kovidgoyal/kitty/pull/%s', '#%s'),
|
||||
'disc': ('https://github.com/kovidgoyal/kitty/discussions/%s', '#%s'),
|
||||
}
|
||||
|
||||
|
||||
def commit_role(
|
||||
@ -517,9 +505,6 @@ def setup(app: Any) -> None:
|
||||
app.connect('html-page-context', add_html_context)
|
||||
app.add_lexer('session', SessionLexer() if version_info[0] < 3 else SessionLexer)
|
||||
app.add_role('link', link_role)
|
||||
app.add_role('iss', partial(num_role, 'issues'))
|
||||
app.add_role('pull', partial(num_role, 'pull'))
|
||||
app.add_role('disc', partial(num_role, 'discussions'))
|
||||
app.add_role('commit', commit_role)
|
||||
# monkey patch sphinx_inline_tabs to avoid a warning about parallel reads
|
||||
# see https://github.com/pradyunsg/sphinx-inline-tabs/issues/26
|
||||
|
||||
@ -20,8 +20,7 @@ kitty
|
||||
.. tab:: Fast
|
||||
|
||||
* Offloads rendering to the GPU for :doc:`lower system load <performance>`
|
||||
* Uses threaded rendering for
|
||||
`absolutely minimal latency <https://github.com/kovidgoyal/kitty/issues/2701#issuecomment-636497270>`_
|
||||
* Uses threaded rendering for :iss:`absolutely minimal latency <2701#issuecomment-636497270>`
|
||||
* Performance tradeoffs can be :ref:`tuned <conf-kitty-performance>`
|
||||
|
||||
.. tab:: Capable
|
||||
|
||||
@ -247,8 +247,7 @@ Would open the scrollback buffer in a new :term:`window` when you press the :kbd
|
||||
key. See :sc:`show_scrollback <show_scrollback>` for details.
|
||||
|
||||
If you want to use it with an editor such as vim to get more powerful features,
|
||||
you can see tips for doing so, in
|
||||
`this thread <https://github.com/kovidgoyal/kitty/issues/719>`_.
|
||||
you can see tips for doing so, in :iss:`this thread <719>`.
|
||||
|
||||
If you wish to store very large amounts of scrollback to view using the piping or
|
||||
:sc:`show_scrollback <show_scrollback>` features, you can use the
|
||||
|
||||
@ -987,9 +987,8 @@ The tab bar style, can be one of:
|
||||
A user-supplied Python function called draw_tab is loaded from the file
|
||||
:file:`tab_bar.py` in the kitty config directory. For examples of how to
|
||||
write such a function, see the functions named :code:`draw_tab_with_*` in
|
||||
kitty's source code: :file:`kitty/tab_bar.py`. See also `this discussion
|
||||
<https://github.com/kovidgoyal/kitty/discussions/4447>`_ for examples from
|
||||
kitty users.
|
||||
kitty's source code: :file:`kitty/tab_bar.py`. See also
|
||||
:disc:`this discussion <4447>` for examples from kitty users.
|
||||
:code:`hidden`
|
||||
The tab bar is hidden. If you use this, you might want to create a
|
||||
mapping for the :ref:`action-select_tab`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user