summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-05 15:22:02 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-05 15:22:02 +0100
commite075e0a0ec75b382c98eb478ae878c6958ba76be (patch)
treed0e1de786b501e45d20698eb229541c751af154b
parent2ee9a1eb4483090b3a6eb883db54e26fb7f1b05a (diff)
downloadcgit-assets-e075e0a0ec75b382c98eb478ae878c6958ba76be.tar.gz
cgit-assets-e075e0a0ec75b382c98eb478ae878c6958ba76be.tar.bz2
cgit-assets-e075e0a0ec75b382c98eb478ae878c6958ba76be.tar.lz
cgit-assets-e075e0a0ec75b382c98eb478ae878c6958ba76be.zip
-rw-r--r--.backups/README.md4
-rw-r--r--.backups/md2html31
2 files changed, 35 insertions, 0 deletions
diff --git a/.backups/README.md b/.backups/README.md
new file mode 100644
index 0000000..5a7e629
--- /dev/null
+++ b/.backups/README.md
@@ -0,0 +1,4 @@
+# backups
+
+This directory contains backups of some files used, however this repository isn't upstream.
+
diff --git a/.backups/md2html b/.backups/md2html
new file mode 100644
index 0000000..7ab4c6e
--- /dev/null
+++ b/.backups/md2html
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+# TODO: replace this with an actual markdown library that isnt shit :3
+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('''
+<style>
+@import url("/cgit-assets.git/plain/markdown.css");
+''')
+sys.stdout.write(HtmlFormatter(style='one-dark').get_style_defs('.highlight'))
+sys.stdout.write('''
+</style>
+''')
+sys.stdout.write("<div class='markdown-body'>")
+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("</div>")
+