nixos/make-option-docs: add xref support to markdown conversion
This commit is contained in:
@@ -72,7 +72,10 @@ class Renderer(mistune.renderers.BaseRenderer):
|
|||||||
info = f" language={quoteattr(info)}" if info is not None else ""
|
info = f" language={quoteattr(info)}" if info is not None else ""
|
||||||
return f"<programlisting{info}>\n{escape(text)}</programlisting>"
|
return f"<programlisting{info}>\n{escape(text)}</programlisting>"
|
||||||
def link(self, link, text=None, title=None):
|
def link(self, link, text=None, title=None):
|
||||||
|
tag = "link"
|
||||||
if link[0:1] == '#':
|
if link[0:1] == '#':
|
||||||
|
if text == "":
|
||||||
|
tag = "xref"
|
||||||
attr = "linkend"
|
attr = "linkend"
|
||||||
link = quoteattr(link[1:])
|
link = quoteattr(link[1:])
|
||||||
else:
|
else:
|
||||||
@@ -82,7 +85,7 @@ class Renderer(mistune.renderers.BaseRenderer):
|
|||||||
text = ""
|
text = ""
|
||||||
attr = "xlink:href"
|
attr = "xlink:href"
|
||||||
link = quoteattr(link)
|
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):
|
def list(self, text, ordered, level, start=None):
|
||||||
if ordered:
|
if ordered:
|
||||||
raise NotImplementedError("ordered lists not supported yet")
|
raise NotImplementedError("ordered lists not supported yet")
|
||||||
|
|||||||
Reference in New Issue
Block a user