about summary refs log tree commit diff
path: root/filters/html-converters
diff options
context:
space:
mode:
Diffstat (limited to 'filters/html-converters')
-rwxr-xr-xfilters/html-converters/md2html17
1 files changed, 11 insertions, 6 deletions
diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html
index c8ee7d9..ebf3856 100755
--- a/filters/html-converters/md2html
+++ b/filters/html-converters/md2html
@@ -1,7 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import markdown
+import sys
+import io
 from pygments.formatters import HtmlFormatter
-print('''
+sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
+sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
+sys.stdout.write('''
 <style>
 .markdown-body {
     font-size: 14px;
@@ -279,11 +283,12 @@ print('''
     border: none;
 }
 ''')
-print(HtmlFormatter(style='pastie').get_style_defs('.highlight'))
-print('''
+sys.stdout.write(HtmlFormatter(style='pastie').get_style_defs('.highlight'))
+sys.stdout.write('''
 </style>   
 ''')
-print("<div class='markdown-body'>")
+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"], extension_configs={"markdown.extensions.codehilite":{"css_class":"highlight"}})
-print("</div>")
+sys.stdout.write("</div>")
follow=1'>Source .editrc before applying -v or -eJune McEnroe Otherwise a bind -v in .editrc will take precedence and overwrite the ^I binding for sh-complete. 2019-12-20Disable signing commitsJune McEnroe Why did I ever turn this on? This gets me nothing but inconvenience. RIP to all the wasted bytes in my git repos. 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table. 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe :target persists after you click on something else. 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc. 2019-12-16Post "cgit setup"June McEnroe