[clang] [docs] Rewrite the ghlink Sphinx plugin to use doctree (PR #199076)

Anshul Nigham via cfe-commits cfe-commits at lists.llvm.org
Sat May 23 23:49:43 PDT 2026


================
@@ -1,19 +1,86 @@
 #!/usr/bin/env python3
 
-from sphinx.application import Sphinx
+"""Script to link #GH123 to our github issue tracker.
+
+We use MyST and reST, so this Sphinx plugin operates on the shared doctree
+representation of the documentation, which is effectively a documentation-AST.
+
+Docutils doctree node reference:
+https://docutils.sourceforge.io/docs/ref/doctree.html
+"""
+
 import re
+from docutils import nodes
+from sphinx.application import Sphinx
 
 __version__ = "1.0"
 
+GH_LINK_RE = re.compile("#GH([0-9]+)")
+GH_LINK_URL = "https://github.com/llvm/llvm-project/issues/{}"
----------------
nigham wrote:

Nit: GH_LINK_TMPL?

https://github.com/llvm/llvm-project/pull/199076


More information about the cfe-commits mailing list