mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Meta: Add anchors to headings of man pages
This commit is contained in:
parent
82ce4acfe5
commit
670925a84f
Notes:
sideshowbarker
2024-07-17 08:45:34 +09:00
Author: https://github.com/tbhaxor Commit: https://github.com/SerenityOS/serenity/commit/670925a84f Pull-request: https://github.com/SerenityOS/serenity/pull/21560
2 changed files with 15 additions and 0 deletions
14
Meta/Websites/man.serenityos.org/add-anchors.lua
Normal file
14
Meta/Websites/man.serenityos.org/add-anchors.lua
Normal 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
|
||||
|
|
@ -42,6 +42,7 @@ for md_file in $(find "${MAN_DIR}" -iname '*.md' | ${SORT}); do
|
|||
pandoc -f gfm -t html5 -s \
|
||||
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||
--lua-filter=Meta/convert-markdown-links.lua \
|
||||
--lua-filter=Meta/Websites/man.serenityos.org/add-anchors.lua \
|
||||
--metadata title="${name}(${section_number}) - SerenityOS man pages" \
|
||||
-o "${output_file}" \
|
||||
"${md_file}" &
|
||||
|
|
Loading…
Reference in a new issue