Ejemplo n.º 1
0
def markdown(text, sanitize=True, linkify=True):
	html = _markdown(text)

	if sanitize:
		html = html.replace("<!-- markdown -->", "")
		html = sanitize_html(html, linkify=linkify)

	return html
Ejemplo n.º 2
0
def markdown(text, sanitize=True, linkify=True):
	html = _markdown(text)

	if sanitize:
		html = html.replace("<!-- markdown -->", "")
		html = sanitize_html(html, linkify=linkify)

	return html
Ejemplo n.º 3
0
def markdown(*args, **kwargs):
    """기존 마크다운 모듈을 깃허브 스타일로 바꿔주는 wrapper 입니다."""
    try:
        extras = kwargs.pop("extras")
    except KeyError:
        extras = []

    extras.extend([
        "code-friendly",
        "fenced-code-blocks",
        "metadata",
        "nofollow",
        "spoiler",
        "tables",
        "target-blank-links",
    ])
    return _markdown(*args, extras=extras, **kwargs)
Ejemplo n.º 4
0
def md_to_html(markdown_text):
    from markdown2 import markdown as _markdown, MarkdownError

    extras = {
        'fenced-code-blocks': None,
        'tables': None,
        'header-ids': None,
        'toc': None,
        'highlightjs-lang': None,
        'html-classes': {
            'table': 'table table-bordered',
            'img': 'screenshot'
        }
    }

    html = None
    try:
        html = UnicodeWithAttrs(_markdown(markdown_text or '', extras=extras))
    except MarkdownError:
        pass

    return html
Ejemplo n.º 5
0
def markdown(text, **kwargs):
    return smart_text(_markdown(text, **kwargs).strip())
Ejemplo n.º 6
0
def markdown(value):
    return mark_safe(_markdown(value))
Ejemplo n.º 7
0
def markdown(text, **kwargs):
    return smart_text(_markdown(text, **kwargs).strip())