当前位置: 首页>>代码示例>>Python>>正文


Python markdown.md函数代码示例

本文整理汇总了Python中markdown.md函数的典型用法代码示例。如果您正苦于以下问题:Python md函数的具体用法?Python md怎么用?Python md使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了md函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: markdown

def markdown(s):
    s = s or ''
    return md(s, [
        'markdown.extensions.tables',
        'markdown.extensions.fenced_code',
        'markdown.extensions.codehilite',
    ])
开发者ID:NiharikaRay,项目名称:panoramix,代码行数:7,代码来源:utils.py

示例2: markdown

def markdown(value, autoescape=True):
    """Converts markdown text into html"""
    #if autoescape:
    #    esc = conditional_escape
    #else:
    #    esc = lambda x: x
    return mark_safe(md(conditional_escape(value)))
开发者ID:lsma,项目名称:kwky,代码行数:7,代码来源:events.py

示例3: markdown

def markdown(raw):
    html = md(raw, extensions=['gfm'])
    if not html.strip():
        return html
    kill_tags = ['body', 'head', 'style']
    cleaner   = Cleaner(kill_tags = kill_tags)
    html      = cleaner.clean_html(html)
    return html
开发者ID:suesan,项目名称:uknow,代码行数:8,代码来源:views.py

示例4: markdown

def markdown(value):
    """
    Run text through markdown process

    >>> markdown('*test*')
    Markup(u'<p><em>test</em></p>')
    """
    return Markup(md(value))
开发者ID:eyeseast,项目名称:tarbell,代码行数:8,代码来源:template.py

示例5: parse_speaker

def parse_speaker(speaker, content):
    speaker = speaker.lower().title()
    p, created = Post.objects.get_or_create(
            thread=t, author=characters[speaker],
            content_plain=content)
    if created:
        p.content_html = sp(md(text=content, extensions=["nl2br"]))
        p.creation_date = datetime.datetime.now()  # UTC?
        p.save()
开发者ID:kirillyar,项目名称:pony-forum,代码行数:9,代码来源:mkplaceholders.py

示例6: markdown

def markdown(value, header_level=1):
    html = md(value,
              output_format='html5', safe_mode='escape',
              extensions=[
                  TocExtension(baselevel=header_level),
                  CodeHiliteExtension(),
                  FencedCodeExtension(),
                  TableExtension(),
              ])
    return mark_safe(html)
开发者ID:fromeflow,项目名称:worksite,代码行数:10,代码来源:html.py

示例7: markdown

def markdown(s, markup_wrap=False):
    s = s or ''
    s = md(s, [
        'markdown.extensions.tables',
        'markdown.extensions.fenced_code',
        'markdown.extensions.codehilite',
    ])
    if markup_wrap:
        s = Markup(s)
    return s
开发者ID:JimmyBenKlieve,项目名称:caravel,代码行数:10,代码来源:utils.py

示例8: markdown

    def markdown(text):
        jinja_env = jinja2.Environment()
        jinja_env.filters['media_url'] = media_url_func(site)
        jinja_env.filters['absolute_url'] = absolute_url_func(site)

        jinja_rendered = jinja_env.from_string(text).render()

        return md(
            jinja_rendered,
            tab_length=2,
            extensions=['markdown.extensions.fenced_code']
        )
开发者ID:nickpegg,项目名称:posty,代码行数:12,代码来源:util.py

示例9: ajax_markdown_preview

def ajax_markdown_preview(request):
    d = {}
    if request.method == "POST":
        raw = request.POST.get('md','')
        raw.lstrip()
        html = md(raw, extensions=['gfm'])
        d['html'] = html
        d['code'] = 0
        d['msg']  = 'success'
        return HttpResponse(json.dumps(d),content_type="application/json")
    else:
        d['code'] = 1
        d['msg'] = 'invalid request method'
        return HttpResponse(json.dumps(d),content_type="application/json")
开发者ID:recall704,项目名称:django-r3call-blog,代码行数:14,代码来源:views.py

示例10: render_card

def render_card(card):
    title = escape(card.title)
    image = card.image.url if card.image else None
    content = mark_safe(md(conditional_escape(card.content)))
    button = card.button

    if content:
        image_height = 100
    else:
        image_height = 180

    return {'title': title,
            'image': image,
            'content': content,
            'button': button,
            'image_height': image_height,}
开发者ID:lsma,项目名称:kwky,代码行数:16,代码来源:home.py

示例11: mdtext

def mdtext(text):
    mdbody = re.sub(
        '\\[\\[(.*?)\\]\\]',
        lambda match: generate_article_link(match.group(1)),
        text
        )

    mdbody = md(
        mdbody,
        extensions=[
            'markdown.extensions.tables',
            'markdown.extensions.footnotes'
        ],
        output_format='html5'
        )

    return bleach.clean(
        mdbody,
        tags=ALLOWED_TAGS
        )
开发者ID:art-solopov,项目名称:mdwiki,代码行数:20,代码来源:markdown_text.py

示例12: sanitise

	def sanitise(self, text, markdown = True):
		if markdown:
			text = md(text)
		
		dom = PyQuery(text)
		
		for a in dom.find('a[href^="javascript:"]'):
			a = PyQuery(a)
			a.replaceWith(a.text())

		for obj in UNCLEAN_TAGS:
			dom.find(obj).remove()

		for attr in UNCLEAN_ATTRS:
			dom.find('[%s]' % attr).removeAttr(attr)
		
		text = dom.outerHtml()
		if markdown:
			dom = HTML2Text()
			text = dom.handle(text)

		return text
开发者ID:iamsteadman,项目名称:social-comments,代码行数:22,代码来源:__init__.py

示例13: api_index

def api_index():
    return flask.make_response(md(open('README.md','r').read()))
开发者ID:jstacoder,项目名称:taplet-api-challenge,代码行数:2,代码来源:app.py

示例14: markdown

def markdown(s):
    return md(s, ['markdown.extensions.tables'])
开发者ID:gitter-badger,项目名称:panoramix,代码行数:2,代码来源:utils.py

示例15: markdown

def markdown(post):
  page = linkname(post.category.name)
  prefix = 'https://s3.amazonaws.com/vineel.me/%s/' % post.id
  return Markup(md(post.body, ['awsimage(PREFIX=%s)' % prefix, 'syntax']))
开发者ID:vineel-adusumilli,项目名称:vineel.me,代码行数:4,代码来源:app.py


注:本文中的markdown.md函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。