Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_markdown_object(buf):
return markdown.markdown("\n".join(buf), extras=['tables', 'codehilite'])
def generate_doc(config):
docdir = os.path.join(cwd,'documentation')
if not os.path.exists(docdir):
print "Couldn't find documentation file at: %s" % docdir
return None
try:
import markdown2 as markdown
except ImportError:
import markdown
documentation = []
for file in os.listdir(docdir):
if file in ignoreFiles or os.path.isdir(os.path.join(docdir, file)):
continue
md = open(os.path.join(docdir,file)).read()
html = markdown.markdown(md)
documentation.append({file:html});
return documentation
if not os.path.exists(docdir):
docdir = os.path.join(cwd,'..','documentation')
if not os.path.exists(docdir):
print "Couldn't find documentation file at: %s" % docdir
return None
try:
import markdown2 as markdown
except ImportError:
import markdown
documentation = []
for file in os.listdir(docdir):
if file in ignoreFiles or os.path.isdir(os.path.join(docdir, file)):
continue
md = open(os.path.join(docdir,file)).read()
html = markdown.markdown(md)
documentation.append({file:html});
return documentation
def get_metadata_div(strategy: bt.Strategy) -> str:
md = ""
md += _get_strategy(strategy)
md += '* * *'
md += _get_datas(strategy)
md += '* * *'
md += _get_observers(strategy)
md += '* * *'
md += _get_analyzers(strategy)
md += '* * *'
css_classes = {'table': 'metaDataTable'}
html = markdown2.markdown(md, extras={
'fenced-code-blocks': None,
'tables': None,
'html-classes': css_classes
})
return html
def _get_markdown_object(buf):
return markdown.markdown("\n".join(buf), extras=['tables', 'codehilite'])
def get_blog(id):
# 根据博客id查询该博客信息
blog = yield from Blog.find(id)
# 根据博客id查询该条博客的评论
comments = yield from Comment.findAll('blog_id=?', [id], orderBy='created_at desc')
# markdown2是个扩展模块,这里把博客正文和评论套入到markdonw2中
for c in comments:
c.html_content = text2html(c.content)
blog.html_content = markdown2.markdown(blog.content)
# 返回页面
return {
'__template__': 'blog.html',
'blog': blog,
'comments': comments
}
def render_markdown(text):
return markdown.markdown(
text,
extras = ["tables", "code-friendly", "fenced-code-blocks"]
)
if not os.path.exists(docdir):
print "Couldn't find documentation file at: %s" % docdir
return None
sdk = config['TITANIUM_SDK']
support_dir = os.path.join(sdk,'module','support')
sys.path.append(support_dir)
try:
import markdown2 as markdown
except ImportError:
import markdown
documentation = []
for file in os.listdir(docdir):
if file in ignoreFiles or os.path.isdir(os.path.join(docdir, file)):
continue
md = open(os.path.join(docdir,file)).read()
html = markdown.markdown(md)
documentation.append({file:html});
return documentation
ret['title'] = m.group(1)
# If the doc starts with a main title, we remove it
# as it will be preserved in the CMS Page title
# Without this, the title would appear twice on the site.
md = re.sub(ur'(?usi)^\s*', '', md)
md = re.sub(ur'(?usi)\s*$', '', md)
md = re.sub(ur'(?ui)^#\s+[^\n\r]*', '', md)
break
# convert the document to HTML
import markdown2
from django.utils.safestring import mark_safe
md = preprocess_markdown(md, request)
html = markdown2.markdown(md)
html = postprocess_markdown(html, request)
ret['content'] = mark_safe(html)
return ret
def generate_doc(config):
docdir = os.path.join(cwd,'documentation')
if not os.path.exists(docdir):
print "Couldn't find documentation file at: %s" % docdir
return None
try:
import markdown2 as markdown
except ImportError:
import markdown
documentation = []
for file in os.listdir(docdir):
if file in ignoreFiles or os.path.isdir(os.path.join(docdir, file)):
continue
md = open(os.path.join(docdir,file)).read()
html = markdown.markdown(md)
documentation.append({file:html});
return documentation