1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-21 00:49:27 +03:00

nixos-render-docs: add heading id support

as with inline spans we support only ids being set for heading, not
arbitrary attributes or classes.
This commit is contained in:
pennae 2023-01-25 18:19:11 +01:00
parent 82d5698e22
commit 8e3b2a4eaa
3 changed files with 119 additions and 1 deletions

View file

@ -246,4 +246,7 @@ class DocBookRenderer(Renderer):
def _heading_tag(self, token: Token, tokens: Sequence[Token], i: int, options: OptionsDict,
env: MutableMapping[str, Any]) -> tuple[str, dict[str, str]]:
return ("section", {})
attrs = {}
if id := token.attrs.get('id'):
attrs['xml:id'] = cast(str, id)
return ("section", attrs)