Dominic Davis-Foster <dom131...@googlemail.com> added the comment:
I'm not sure this is a Pygments or Sphinx bug. The documentation for the :keyword: role[1] says: This creates a link to a reference label with that name, if it exists. Looking at the documentation source for "Compound statements"[2] each section for a particular keyword is preceded by a reference label for the relevant keyword(s). So for "match" and "case" all that's needed is to put the label before the section of the docs talking about them. In fact, it seems that "match" does have a label[3], and I can link to it successfully; it's just "case" and "_" that don't work "_" is more tricky, as you can't have a reference label called that. However, if you pick another name for the label (say, "underscore") you can use that as the target name and still have "_" as the text like so: :keyword:`_ <underscore>` [1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-keyword [2] https://raw.githubusercontent.com/python/cpython/main/Doc/reference/compound_stmts.rst [3] https://github.com/python/cpython/blame/main/Doc/reference/compound_stmts.rst#L514 ---------- nosy: +dom1310df _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44084> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com