mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
nixos/make-option-docs: add xref support to markdown conversion
This commit is contained in:
parent
7a091b2686
commit
645cfa59ac
1 changed files with 4 additions and 1 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue