Skip to content

Commit

Permalink
document how to use highlight mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffWilliams committed Sep 7, 2018
1 parent 323dea9 commit 477e19c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mistune_contrib/highlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ def block_code(text, lang, inlinestyles=False, linenos=False):


class HighlightMixin(object):
"""Highlight mixin for Renderer, mix this with Renderer::
class HighlightRenderer(HighlightMixin, Renderer):
pass
highlight = HighlightRenderer()
highlight.options = {
"linenos": "inline",
"full": True,
#"inlinestyles": True,
}
md = mistune.Markdown(renderer=highlight)
html = md(md_txt)
"""

def block_code(self, text, lang):
# renderer has an options
inlinestyles = self.options.get('inlinestyles', False)
Expand Down

0 comments on commit 477e19c

Please sign in to comment.