[PATCH] filters: add HTML converter for asciidoc markup

Shulhan ms at kilabit.info
Fri Apr 17 20:22:10 UTC 2026


The first style "div#cgit div.content" fix "pre" tag rendered with
bottom border.

The next style "div#cgit div.content pre" and "code" follow the "pre"
and "code" tags styles from Markdown.

Signed-off-by: Shulhan <ms at kilabit.info>
---
Here is the screenshots of styles without and with style added to
adoc2html,

Before style: https://storage.googleapis.com/umum.kilabit.info/patch/cgit/adoc/before_css.png

After style: https://storage.googleapis.com/umum.kilabit.info/patch/cgit/adoc/after_css.png

 cgitrc.5.txt                      |  2 ++
 filters/about-formatting.sh       |  1 +
 filters/html-converters/adoc2html | 21 +++++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100755 filters/html-converters/adoc2html

diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 7c39bf9..c03cfda 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -912,6 +912,7 @@ about-filter=/var/www/cgit/filters/about-formatting.sh
 ## Search for these files in the root of the default branch of repositories
 ## for coming up with the about page:
 ##
+readme=:README.adoc
 readme=:README.md
 readme=:readme.md
 readme=:README.mkd
@@ -926,6 +927,7 @@ readme=:README.txt
 readme=:readme.txt
 readme=:README
 readme=:readme
+readme=:INSTALL.adoc
 readme=:INSTALL.md
 readme=:install.md
 readme=:INSTALL.mkd
diff --git a/filters/about-formatting.sh b/filters/about-formatting.sh
index 85daf9c..8e1fa88 100755
--- a/filters/about-formatting.sh
+++ b/filters/about-formatting.sh
@@ -19,6 +19,7 @@
 
 cd "$(dirname $0)/html-converters/"
 case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in
+	*.adoc) exec ./adoc2html; ;;
 	*.markdown|*.mdown|*.md|*.mkd) exec ./md2html; ;;
 	*.rst) exec ./rst2html; ;;
 	*.[1-9]) exec ./man2html; ;;
diff --git a/filters/html-converters/adoc2html b/filters/html-converters/adoc2html
new file mode 100755
index 0000000..0d55e2d
--- /dev/null
+++ b/filters/html-converters/adoc2html
@@ -0,0 +1,21 @@
+#!/bin/sh
+echo "<style>"
+echo "  div#cgit div.content { border-bottom: unset; padding: unset; }"
+echo "  div#cgit div.content pre {\
+  background-color: #f8f8f8;\
+  border: 1px solid #ccc;\
+  font-size: 13px;\
+  line-height: 19px;\
+  overflow: auto;\
+  padding: 6px 10px;\
+  border-radius: 3px;\
+}"
+echo "  code {\
+ margin: 0 2px;\
+ padding: 0px 5px;\
+ border: 1px solid #eaeaea;\
+ background-color: #f8f8f8;\
+ border-radius: 3px;\
+}"
+echo "</style>"
+exec asciidoctor --no-header-footer --safe-mode=server -

base-commit: 829eb0711305e8946fa2f4a1c57c43354f35e208
prerequisite-patch-id: 7a0303d4a9294a9a0ef18d5915080b479468b276
-- 
2.54.0.rc2.6.g1194a4dfc5.dirty



More information about the CGit mailing list