diff options
author | pennae <github@quasiparticle.net> | 2022-08-03 19:18:33 +0200 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2022-08-03 22:01:14 +0200 |
commit | 645cfa59ac5690187eac40ef2ac67381668acecc (patch) | |
tree | d4fc084988002bee7a42a7a7940511c8a7662cb8 | |
parent | 7a091b2686ff9997cc403bb5cecb4cb93e916c1b (diff) |
nixos/make-option-docs: add xref support to markdown conversion
-rw-r--r-- | nixos/lib/make-options-doc/mergeJSON.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/lib/make-options-doc/mergeJSON.py b/nixos/lib/make-options-doc/mergeJSON.py index 8fb0b65c82d8c..d7dc6ca30074e 100644 --- a/nixos/lib/make-options-doc/mergeJSON.py +++ b/nixos/lib/make-options-doc/mergeJSON.py @@ -72,7 +72,10 @@ class Renderer(mistune.renderers.BaseRenderer): info = f" language={quoteattr(info)}" if info is not None else "" return f"<programlisting{info}>\n{escape(text)}</programlisting>" def link(self, link, text=None, title=None): + tag = "link" if link[0:1] == '#': + if text == "": + tag = "xref" attr = "linkend" link = quoteattr(link[1:]) else: @@ -82,7 +85,7 @@ class Renderer(mistune.renderers.BaseRenderer): text = "" attr = "xlink:href" link = quoteattr(link) - return f"<link {attr}={link}>{text}</link>" + return f"<{tag} {attr}={link}>{text}</{tag}>" def list(self, text, ordered, level, start=None): if ordered: raise NotImplementedError("ordered lists not supported yet") |