summaryrefslogtreecommitdiffstats
path: root/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/simple/cgit-about-filter/cgit-about-filter.lua')
-rw-r--r--pkgs/simple/cgit-about-filter/cgit-about-filter.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
index 5333d40..0833c38 100644
--- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
+++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
@@ -246,6 +246,13 @@ local function heading_ids(output)
end))
end
+-- Highlight the heading a #fragment points to.
+local target_style = [[
+<style>
+div#summary :is(h1, h2, h3, h4, h5, h6):target { background-color: #ffffcc; }
+</style>
+]]
+
-- Render ```mermaid code blocks in the browser.
local mermaid_script = [[
<script type="module">
@@ -401,6 +408,9 @@ local function close()
local output = md2html(processed)
if output then
output = heading_ids(output)
+ if output:find('<h%d id="') then
+ emit(target_style)
+ end
if output:find("<table>", 1, true) then
emit(table_style)
output = layout_tables(output)