diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-23 06:32:03 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-23 15:00:05 +0100 |
commit | 1892cd9a603e1eda206c40efb576bd75b7532be6 (patch) | |
tree | 05d6ad5f434cbe2493fb2625b9bd0d34912b0a9c /filters | |
parent | git: update to v2.7.2 (diff) | |
download | cgit-pink-1892cd9a603e1eda206c40efb576bd75b7532be6.tar.gz cgit-pink-1892cd9a603e1eda206c40efb576bd75b7532be6.zip |
md2html: Do syntax highlighting too
Diffstat (limited to 'filters')
-rwxr-xr-x | filters/html-converters/md2html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html index 67141ba..c8ee7d9 100755 --- a/filters/html-converters/md2html +++ b/filters/html-converters/md2html @@ -1,5 +1,6 @@ #!/usr/bin/env python import markdown +from pygments.formatters import HtmlFormatter print(''' <style> .markdown-body { @@ -277,9 +278,12 @@ print(''' background-color: transparent; border: none; } +''') +print(HtmlFormatter(style='pastie').get_style_defs('.highlight')) +print(''' </style> ''') print("<div class='markdown-body'>") # Note: you may want to run this through bleach for sanitization -markdown.markdownFromFile(output_format="html5") +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>") |