def test_utils(self): md5 = get_md5('test') self.assertIsNotNone(md5) c = CommonMarkdown.get_markdown(''' # Title1 ```python import os ``` [url](https://www.lylinux.net/) [ddd](http://www.baidu.com) ''') self.assertIsNotNone(c) d = {'d': 'key1', 'd2': 'key2'} data = parse_dict_to_url(d) self.assertIsNotNone(data) render = BlogMarkDownRenderer() s = render.autolink('http://www.baidu.com') self.assertTrue(s.find('nofollow') > 0) s = render.link('http://www.baidu.com', 'test', 'test') self.assertTrue(s.find('nofollow') > 0)
def custom_markdown(content): # import requests # pload = {'markDownData': content} # r = requests.post('http://localhost:3000/markdown', data=pload) # return mark_safe(r.text) from DjangoBlog.utils import CommonMarkdown return mark_safe(CommonMarkdown.get_markdown(content))
def item_description(self, item): return CommonMarkdown.get_markdown(item.body)
def item_description(self, item): return CommonMarkdown.get_markdown(item.body)
def custom_markdown(content): from DjangoBlog.utils import CommonMarkdown return CommonMarkdown.get_markdown(content)
def custom_markdown(content): from DjangoBlog.utils import CommonMarkdown return mark_safe(CommonMarkdown.get_markdown(content))