We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
^question. If so, how can I use Pygments or some other library? Thanks!
The text was updated successfully, but these errors were encountered:
aha, I should have read the README, oops.
Sorry, something went wrong.
This is the top link in google search, so ill add this for anyone else looking for it.
import mistune from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import html class HighlightRenderer(mistune.Renderer): def block_code(self, code, lang): if not lang: return '\n<pre><code>%s</code></pre>\n' % \ mistune.escape(code) lexer = get_lexer_by_name(lang, stripall=True) formatter = html.HtmlFormatter(lineseparator="<br>") return highlight(code, lexer, formatter) renderer = HighlightRenderer() markdown = mistune.Markdown(renderer=renderer) output_html = markdown(content_document) print(output_html)
No branches or pull requests
^question. If so, how can I use Pygments or some other library? Thanks!
The text was updated successfully, but these errors were encountered: