def parse_markdown():
text = request.args.get('text')
if text is None:
abort(404)
highlight = request.args.get('word')
if highlight is not None:
text = text.replace(highlight, '**' + highlight + '**')
# Anything that isn't a square closing bracket
name_regex = "[^]]+"
# http:// or https:// followed by anything but a closing paren
url_regex = "http[s]?://[^)]+"
markup_regex = '\[({0})]\(\s*({1})\s*\)'.format(name_regex, url_regex)
for match in re.findall(markup_regex, text):
print(match)
print(match[0])
print(match[1])
text = text.replace("[" + match[0] + "](" + match[1] + ")", match[0])
processed = markdown2.markdown(text)
return json.dumps({"result": processed})
评论列表
文章目录