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/md2html | 307 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 gitolite-cgit/md2html (limited to 'gitolite-cgit/md2html') 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