From 3d57242810feab10c11cd1df66a7c2958869497f Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 11:51:38 +0000 Subject: cgit-about-filter: link symbol after headings A chain link after each heading links to it, so the link can be copied. It shows when the heading is hovered or focused, and always on devices without hover. --- pkgs/simple/cgit-about-filter/cgit-about-filter.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua index 0833c38..f317c54 100644 --- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua +++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua @@ -227,6 +227,17 @@ local function slug(content) return (text:lower():gsub("[^%w%s_%-\128-\255]", ""):gsub("%s", "-")) end +-- A chain link, after each heading, linking to it. +local anchor = [[]] + +local anchor_style = [[ + +]] + -- Give headings ids, so links to #fragments work. A repeated id gets -1, -- -2, etc., and so do ids cgit uses on the about page itself. local function heading_ids(output) @@ -242,7 +253,7 @@ local function heading_ids(output) else seen[id] = 0 end - return string.format('%s', level, id, content, level) + return string.format('%s' .. anchor .. '', level, id, content, id, level) end)) end @@ -410,6 +421,7 @@ local function close() output = heading_ids(output) if output:find('", 1, true) then emit(table_style) -- cgit v1.3.1