serenity/Meta/Websites/man.serenityos.org/add-anchors.lua
2023-10-30 10:26:21 +00:00

14 lines
No EOL
490 B
Lua

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