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.ifconfig',
|
||||||
'sphinx.ext.viewcode',
|
'sphinx.ext.viewcode',
|
||||||
'sphinx.ext.githubpages',
|
'sphinx.ext.githubpages',
|
||||||
|
'sphinx.ext.extlinks',
|
||||||
'sphinx_copybutton',
|
'sphinx_copybutton',
|
||||||
'sphinx_inline_tabs',
|
'sphinx_inline_tabs',
|
||||||
"sphinxext.opengraph",
|
"sphinxext.opengraph",
|
||||||
@ -167,24 +168,11 @@ texinfo_documents = [
|
|||||||
|
|
||||||
# GitHub linking inline roles {{{
|
# GitHub linking inline roles {{{
|
||||||
|
|
||||||
def num_role(
|
extlinks = {
|
||||||
which: str, name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
|
'iss': ('https://github.com/kovidgoyal/kitty/issues/%s', '#%s'),
|
||||||
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
|
'pull': ('https://github.com/kovidgoyal/kitty/pull/%s', '#%s'),
|
||||||
' Link to a github issue '
|
'disc': ('https://github.com/kovidgoyal/kitty/discussions/%s', '#%s'),
|
||||||
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], []
|
|
||||||
|
|
||||||
|
|
||||||
def commit_role(
|
def commit_role(
|
||||||
@ -517,9 +505,6 @@ def setup(app: Any) -> None:
|
|||||||
app.connect('html-page-context', add_html_context)
|
app.connect('html-page-context', add_html_context)
|
||||||
app.add_lexer('session', SessionLexer() if version_info[0] < 3 else SessionLexer)
|
app.add_lexer('session', SessionLexer() if version_info[0] < 3 else SessionLexer)
|
||||||
app.add_role('link', link_role)
|
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)
|
app.add_role('commit', commit_role)
|
||||||
# monkey patch sphinx_inline_tabs to avoid a warning about parallel reads
|
# monkey patch sphinx_inline_tabs to avoid a warning about parallel reads
|
||||||
# see https://github.com/pradyunsg/sphinx-inline-tabs/issues/26
|
# see https://github.com/pradyunsg/sphinx-inline-tabs/issues/26
|
||||||
|
|||||||
@ -20,8 +20,7 @@ kitty
|
|||||||
.. tab:: Fast
|
.. tab:: Fast
|
||||||
|
|
||||||
* Offloads rendering to the GPU for :doc:`lower system load <performance>`
|
* Offloads rendering to the GPU for :doc:`lower system load <performance>`
|
||||||
* Uses threaded rendering for
|
* Uses threaded rendering for :iss:`absolutely minimal latency <2701#issuecomment-636497270>`
|
||||||
`absolutely minimal latency <https://github.com/kovidgoyal/kitty/issues/2701#issuecomment-636497270>`_
|
|
||||||
* Performance tradeoffs can be :ref:`tuned <conf-kitty-performance>`
|
* Performance tradeoffs can be :ref:`tuned <conf-kitty-performance>`
|
||||||
|
|
||||||
.. tab:: Capable
|
.. 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.
|
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,
|
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
|
you can see tips for doing so, in :iss:`this thread <719>`.
|
||||||
`this thread <https://github.com/kovidgoyal/kitty/issues/719>`_.
|
|
||||||
|
|
||||||
If you wish to store very large amounts of scrollback to view using the piping or
|
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
|
: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
|
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
|
: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
|
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
|
kitty's source code: :file:`kitty/tab_bar.py`. See also
|
||||||
<https://github.com/kovidgoyal/kitty/discussions/4447>`_ for examples from
|
:disc:`this discussion <4447>` for examples from kitty users.
|
||||||
kitty users.
|
|
||||||
:code:`hidden`
|
:code:`hidden`
|
||||||
The tab bar is hidden. If you use this, you might want to create a
|
The tab bar is hidden. If you use this, you might want to create a
|
||||||
mapping for the :ref:`action-select_tab`
|
mapping for the :ref:`action-select_tab`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user