From e075e0a0ec75b382c98eb478ae878c6958ba76be Mon Sep 17 00:00:00 2001 From: memdmp Date: Sun, 5 Jan 2025 15:22:02 +0100 Subject: - --- .backups/README.md | 4 ++++ .backups/md2html | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .backups/README.md create mode 100644 .backups/md2html 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(''' + +''') +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