diff options
| author | tv <tv@krebsco.de> | 2026-11-18 11:47:28 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 12:49:09 +0100 |
| commit | ac6ec0d3a636514e854947d523c128ae59361143 (patch) | |
| tree | 22f1648ca99224baf52925d3837f29267b2f5f21 | |
| parent | 502cab0a2f1196e9755e488b481a363be950d9f6 (diff) | |
cgit-about-filter: highlight the target heading
| -rw-r--r-- | pkgs/simple/cgit-about-filter/cgit-about-filter.lua | 10 |
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) |
