1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

Meta: Add anchors to headings of man pages

This commit is contained in:
Gurkirat Singh 2023-10-23 21:47:43 +05:30 committed by Sam Atkins
parent 82ce4acfe5
commit 670925a84f
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,14 @@
function Header(header)
local level = header.level
local identifier = header.identifier
local anchor = pandoc.RawInline('html', '<a style="margin-right: 15px" href="#' .. identifier .. '">#</a>')
-- Create a list of inline elements containing the anchor and header content
local new_content = pandoc.List({anchor})
for _, elem in ipairs(header.content) do
new_content:insert(elem)
end
return pandoc.Header(level, new_content, identifier)
end