nixos-render-docs: add inline anchor plugin

supports the […]{#id} inline anchor syntax. other features of bracketed
spans are intentionally not supported.
This commit is contained in:
pennae 2023-01-25 01:08:49 +01:00
parent 41a5c3a93d
commit 6829c6c335
4 changed files with 226 additions and 0 deletions

View file

@ -200,3 +200,6 @@ class DocBookRenderer(Renderer):
else:
return ref
raise NotImplementedError("md node not supported yet", token)
def inline_anchor(self, token: Token, tokens: Sequence[Token], i: int, options: OptionsDict,
env: MutableMapping[str, Any]) -> str:
return f'<anchor xml:id={quoteattr(cast(str, token.attrs["id"]))} />'