From 59a573d25f34db0fabbebea7fcb33d30335aa10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Thu, 8 Apr 2021 19:14:52 -0500 Subject: Add custom md2html file for dark-node --- gitolite-cgit/Dockerfile | 2 + gitolite-cgit/md2html | 307 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 309 insertions(+) create mode 100644 gitolite-cgit/md2html diff --git a/gitolite-cgit/Dockerfile b/gitolite-cgit/Dockerfile index e1ac072..2a8c6ce 100644 --- a/gitolite-cgit/Dockerfile +++ b/gitolite-cgit/Dockerfile @@ -28,7 +28,9 @@ EXPOSE 22 80 9418 WORKDIR /var/lib/git COPY cgit.css /usr/share/webapps/cgit/cgit.css +COPY md2html /usr/lib/cgit/filters/html-converters/md2html COPY gitolite.rc /var/lib/git/.gitolite.rc COPY entrypoint.sh / + RUN chmod u+x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/gitolite-cgit/md2html b/gitolite-cgit/md2html new file mode 100644 index 0000000..3c507d0 --- /dev/null +++ b/gitolite-cgit/md2html @@ -0,0 +1,307 @@ +#!/usr/bin/env python3 +import markdown +import sys +import io +from pygments.formatters import HtmlFormatter +from markdown.extensions.toc import TocExtension +sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') +sys.stdout.write(''' + +''') +sys.stdout.write("
") +sys.stdout.flush() +# Note: you may want to run this through bleach for sanitization +markdown.markdownFromFile( + output_format="html5", + extensions=[ + "markdown.extensions.fenced_code", + "markdown.extensions.codehilite", + "markdown.extensions.tables", + TocExtension(anchorlink=True)], + extension_configs={ + "markdown.extensions.codehilite": {"css_class": "highlight"}}) +sys.stdout.write("
") -- cgit v1.2.3