Files
nixarr/docs/pandoc/anchor-links.lua
T
2024-02-26 13:58:41 +01:00

15 lines
405 B
Lua

-- Adds anchor links to headings with IDs.
function Header (h)
if h.identifier ~= '' then
-- an empty link to this header
local anchor_link = pandoc.Link(
{}, -- content
'#' .. h.identifier, -- href
'', -- title
{class = 'anchor', ['aria-hidden'] = 'true'} -- attributes
)
h.content:insert(1, anchor_link)
return h
end
end