本文整理匯總了Python中markdown2.markdown方法的典型用法代碼示例。如果您正苦於以下問題:Python markdown2.markdown方法的具體用法?Python markdown2.markdown怎麽用?Python markdown2.markdown使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊markdown2的用法示例。
在下文中一共展示了markdown2.markdown方法的29個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1: rich_edit_static
點讚 6
# 需要導入模塊: import markdown2 [as 別名]
# 或者: from markdown2 import markdown [as 別名]
def rich_edit_static(context):
files = [
"" % static(
"simplemde/simplemde.min.css"),
"" % static(
"font-awesome/css/font-awesome.min.css"),
"" % static(
"simplemde/marked.min.js"),
"" % static(
"simplemde/simplemde.min.js"),
"" % static(
"simplemde/inline-attachment.min.js"),
"" % static(
"simplemde/codemirror.inline-attachment.js"),
"" % static(
"simplemde/markdown.js")
]
return mark_safe("\n".join(files))
開發者ID:certsocietegenerale,項目名稱:FIR,代碼行數:21,
示例2: send
點讚 6
# 需要導入模塊: import markdown2 [as 別名]
# 或者: from markdown2 import markdown [as 別名]
def send(self, event, users, instance, paths):
if not self._ensure_connection():
print("Cannot contact the XMPP server")
return
for user, templates in users.items():
jid = self._get_jid(user)
if not self.enabled(event, user, paths) or jid is None:
continue
template = self._get_template(templates)
if template is None:
continue
params = self.prepare(template, instance)
message = xmpp.protocol.Message(jid, body=params['short_description'].encode('utf-8'),
subject=params['subject'].encode('utf-8'), typ='chat')
html = xmpp.Node('html', {'xmlns': 'http://jabber.org/protocol/xhtml-im'})
text = u"
" + markdown2.markdown(params['short_description'],extras=["link-patterns"],
link_patterns=link_registry.link_patterns(
request),
safe_mode=True) + u""
html.addChild(node=xmpp.simplexml.XML2Node(text.encode('utf-8')))
message.addChild(node=html)
self.client.send(message)
self.client.disconnected()
開發者ID:certsocietegenerale,項目名稱:FIR,代碼行數:27,
示例3: main
點讚 6
# 需要導入模塊: import markdown2 [as 別名]
# 或者: from markdown2 import markdown [as 別名]
def main():
"""Covert GitHub mardown to AnkiWeb HTML."""
# permitted tags: img, a, b, i, code, ul, ol, li
translate = [
(r'
(r'
(r'
(r'([^', r'\1'),
(r'([^', r'\1'),
(r'([^', r'\1
'),
(r'
', r'\n'),(r'
', r''),
(r'
', r'\n\n'),(r'(ol|ul)>(?!(li|[ou]l)>)', r'\1>\n'),
]
with open('README.md', encoding='utf-8') as f:
html = ''.join(filter(None, markdown(f.read()).split('\n')))
for a, b in translate:
html = sub(a, b, html)
with open('README.html', 'w', encoding='utf-8') as f:
f.write(html.strip())
開發者ID:luoliyan,項目名稱:chinese-support-redux,代碼行數:27,
示例4: get
點讚 6
# 需要導入模塊: import markdown2 [as 別名]
# 或者: from markdown2 import markdown [as 別名]
def get(self, request, param):
print('path:%s param:%s' % (request.path, param))
try:
article = JDCommentAnalysis.objects.filter(Q(guid__iexact = param) | Q(product_id__iexact = param)).first()
article.content = markdown2.markdown(text = article.content, extras = {
'tables': True,
'wiki-tables': True,
'fenced-code-blocks': True,
})
context = {
'article': article
}
return render(request, 'full_result.html', context = context)
except:
return render(request, '404.html')
開發者ID:awolfly9,項目名稱:jd_analysis,代碼行數:19,
示例5: record_result
點讚 6
# 需要導入模塊: import markdown2 [as 別名]
# 或者: from markdown2 import m