Coverage for markupmirror.markup.markdown_: 91%

# Coverage for markupmirror.markup.markdown_ : 91%

## 22 statements 20 run 2 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import logging from django.utils.translation import ugettext_lazy as _ from markupmirror import settings from markupmirror.markup.base import BaseMarkup from markupmirror.markup.base import register_markup class MarkdownMarkup(BaseMarkup): """Markup transformer for `Markdown`_ content. .. _Markdown: http://daringfireball.net/projects/markdown/ """ codemirror_mode = 'text/x-markdown' title = _(u"Markdown") def __init__(self): self.extensions = settings.MARKUPMIRROR_MARKDOWN_EXTENSIONS self.output_format = settings.MARKUPMIRROR_MARKDOWN_OUTPUT_FORMAT self.markdown = Markdown( extensions=self.extensions, output_format=self.output_format) def convert(self, markup): return self.markdown.convert(markup) # Only register if Markdown is installed try: from markdown import Markdown register_markup(MarkdownMarkup) # logging handler for markdown logger = logging.getLogger('MARKDOWN') logger.addHandler(logging.StreamHandler()) except ImportError: pass __all__ = ('MarkdownMarkup',)