diff options
-rwxr-xr-x | filters/html-converters/md2html | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html index ebf3856..dc20f42 100755 --- a/filters/html-converters/md2html +++ b/filters/html-converters/md2html | |||
@@ -3,6 +3,7 @@ import markdown | |||
3 | import sys | 3 | import sys |
4 | import io | 4 | import io |
5 | from pygments.formatters import HtmlFormatter | 5 | from pygments.formatters import HtmlFormatter |
6 | from markdown.extensions.toc import TocExtension | ||
6 | sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') | 7 | sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') |
7 | sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') | 8 | sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') |
8 | sys.stdout.write(''' | 9 | sys.stdout.write(''' |
@@ -48,10 +49,14 @@ sys.stdout.write(''' | |||
48 | line-height: 1; | 49 | line-height: 1; |
49 | padding-left: 0; | 50 | padding-left: 0; |
50 | margin-left: -22px; | 51 | margin-left: -22px; |
51 | top: 15%} | 52 | top: 15%; |
53 | } | ||
52 | .markdown-body h1:hover a.anchor .mini-icon-link, .markdown-body h2:hover a.anchor .mini-icon-link, .markdown-body h3:hover a.anchor .mini-icon-link, .markdown-body h4:hover a.anchor .mini-icon-link, .markdown-body h5:hover a.anchor .mini-icon-link, .markdown-body h6:hover a.anchor .mini-icon-link { | 54 | .markdown-body h1:hover a.anchor .mini-icon-link, .markdown-body h2:hover a.anchor .mini-icon-link, .markdown-body h3:hover a.anchor .mini-icon-link, .markdown-body h4:hover a.anchor .mini-icon-link, .markdown-body h5:hover a.anchor .mini-icon-link, .markdown-body h6:hover a.anchor .mini-icon-link { |
53 | display: inline-block; | 55 | display: inline-block; |
54 | } | 56 | } |
57 | div#cgit .markdown-body h1 a.toclink, div#cgit .markdown-body h2 a.toclink, div#cgit .markdown-body h3 a.toclink, div#cgit .markdown-body h4 a.toclink, div#cgit .markdown-body h5 a.toclink, div#cgit .markdown-body h6 a.toclink { | ||
58 | color: black; | ||
59 | } | ||
55 | .markdown-body h1 tt, .markdown-body h1 code, .markdown-body h2 tt, .markdown-body h2 code, .markdown-body h3 tt, .markdown-body h3 code, .markdown-body h4 tt, .markdown-body h4 code, .markdown-body h5 tt, .markdown-body h5 code, .markdown-body h6 tt, .markdown-body h6 code { | 60 | .markdown-body h1 tt, .markdown-body h1 code, .markdown-body h2 tt, .markdown-body h2 code, .markdown-body h3 tt, .markdown-body h3 code, .markdown-body h4 tt, .markdown-body h4 code, .markdown-body h5 tt, .markdown-body h5 code, .markdown-body h6 tt, .markdown-body h6 code { |
56 | font-size: inherit; | 61 | font-size: inherit; |
57 | } | 62 | } |
@@ -290,5 +295,13 @@ sys.stdout.write(''' | |||
290 | sys.stdout.write("<div class='markdown-body'>") | 295 | sys.stdout.write("<div class='markdown-body'>") |
291 | sys.stdout.flush() | 296 | sys.stdout.flush() |
292 | # Note: you may want to run this through bleach for sanitization | 297 | # Note: you may want to run this through bleach for sanitization |
293 | markdown.markdownFromFile(output_format="html5", extensions=["markdown.extensions.fenced_code", "markdown.extensions.codehilite", "markdown.extensions.tables"], extension_configs={"markdown.extensions.codehilite":{"css_class":"highlight"}}) | 298 | markdown.markdownFromFile( |
299 | output_format="html5", | ||
300 | extensions=[ | ||
301 | "markdown.extensions.fenced_code", | ||
302 | "markdown.extensions.codehilite", | ||
303 | "markdown.extensions.tables", | ||
304 | TocExtension(anchorlink=True)], | ||
305 | extension_configs={ | ||
306 | "markdown.extensions.codehilite":{"css_class":"highlight"}}) | ||
294 | sys.stdout.write("</div>") | 307 | sys.stdout.write("</div>") |