diff --git a/auxtools/md2html.py b/auxtools/md2html.py
index 74e92ff4..bbecde89 100755
--- a/auxtools/md2html.py
+++ b/auxtools/md2html.py
@@ -6,28 +6,41 @@
import sys
import re
+def out(strDat):
+ if sys.version_info.major < 3:
+ print(strDat)
+ else:
+ sys.stdout.buffer.write(strDat.encode(encoding='utf-8') + b"\n")
+
+mdText = "" # pre-declaration
if sys.version_info.major < 3:
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
-mdText = sys.stdin.read()
+ mdText = sys.stdin.read()
+else:
+ mdText = sys.stdin.buffer.read().decode(encoding='utf-8')
-print("")
-print("")
-print("
")
-print("")
-print("")
-print("" + re.compile('\\r?\\n').split(mdText)[0] + "")
-print("")
-print("")
+titleText = re.compile('\\r?\\n').split(mdText)[0]
-print(markdown.markdown(mdText.replace('.md', '.html'),
- extensions=['tables', 'fenced_code', 'codehilite'],
- extension_configs={
- 'codehilite': {
- 'guess_lang': False,
- },
- },
- output_format='html5'))
+mdText = mdText.replace('.md', '.html')
+mdText = markdown.markdown(mdText,
+ extensions=['tables', 'fenced_code', 'codehilite'],
+ extension_configs={
+ 'codehilite': {
+ 'guess_lang': False,
+ },
+ },
+ output_format='html5')
+mdText = mdText.replace("\ufdef ", "").replace("\ufdef", "")
-print("")
-print("")
+out("")
+out("")
+out("")
+out("")
+out("")
+out("" + titleText + "")
+out("")
+out("")
+out(mdText)
+out("")
+out("")