From cb2199f0b6688ba69ba96f096c460bb167653b9e Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 12 Nov 2026 19:39:32 +0000 Subject: cgit-about-filter: render mermaid diagrams --- .../simple/cgit-about-filter/cgit-about-filter.lua | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'pkgs/simple/cgit-about-filter') diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua index cd20d54..f5a092a 100644 --- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua +++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua @@ -185,6 +185,38 @@ local function layout_tables(output) end)) end +-- Render ```mermaid code blocks in the browser. +local mermaid_script = [[ + +]] + local buffer = "" local should_render = true local current_dir = "" -- Stores the directory prefix of the file being processed @@ -261,6 +293,9 @@ function filter_close() output = layout_tables(output) end emit(output) + if output:find('', 1, true) then + emit(mermaid_script) + end else emit("

Error: Could not execute md2html.

") end -- cgit v1.3.1