本文整理汇总了Python中markdown_adapter.run_markdown函数的典型用法代码示例。如果您正苦于以下问题:Python run_markdown函数的具体用法?Python run_markdown怎么用?Python run_markdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_markdown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_headers
def test_headers(self):
self.assertEqual(
run_markdown('#h1 header'),'<h1>h1 header</h1>')
self.assertEqual(
run_markdown('##h2 header'),'<h2>h2 header</h2>')
self.assertEqual(
run_markdown('###h3 header'),'<h3>h3 header</h3>')
示例2: test_blockquote
def test_blockquote(self):
self.assertEqual(
run_markdown('>single line'),'<blockquote><p>single line</p></blockquote>')
self.assertEqual(
run_markdown('>blockquote\nNo blockquote\n>#header blockquote'),'<blockquote><p>blockquote</p></blockquote>\r\n<p>No blockquote</p>\r\n<blockquote><h1>header blockquote</h1></blockquote>')
self.assertEqual(
run_markdown('>multiline\n>blockquote'),'<blockquote><p>multiline</p>\r\n<p>blockquote</p></blockquote>')
self.assertEqual(
run_markdown('>multiline\n>blockquote\nWith a no blockquote line at the end'),'<blockquote><p>multiline</p>\r\n<p>blockquote</p></blockquote>\r\n<p>With a no blockquote line at the end</p>')
示例3: test_heading
def test_heading(self):
#Lines with '###', '##', or '#' should be wrapped with heading tags
self.assertEqual(
run_markdown('###this should be wrapped in h3 tags'),
'<p><h3>this should be wrapped in h3 tags</h3></p>')
self.assertEqual(
run_markdown('##this should be wrapped in h2 tags'),
'<p><h2>this should be wrapped in h2 tags</h2></p>')
self.assertEqual(
run_markdown('#this should be wrapped in h1 tags'),
'<p><h1>this should be wrapped in h1 tags</h1></p>')
示例4: testHeader
def testHeader(self):
'''
Lines starting with up to 3 # signs should be wrapped in header tages
'''
self.assertEqual(
run_markdown('#this should be wrapped in h1 tags'),
'<h1>this should be wrapped in h1 tags</h1>')
self.assertEqual(
run_markdown('##this should be wrapped in h2 tags'),
'<h2>this should be wrapped in h2 tags</h2>')
self.assertEqual(
run_markdown('###this should be wrapped in h3 tags'),
'<h3>this should be wrapped in h3 tags</h3>')
示例5: test_h3
def test_h3(self):
#Lines surrounded by 3 pound symbols should be wrapped in 'h3' tags
self.assertEqual(
run_markdown('###this should not be wrapped in 3 pound tags###'),
'<p><h3>this should not be wrapped in 3 pound tags</h3></p>')
示例6: test_blockQuote
def test_blockQuote(self):
#Lines with '>' should be wrapped with blockquote tags
self.assertEqual(
run_markdown('>this should be wrapped in blockquote tags\n>and this too\nbut not this'),
'<blockquote><p>this should be wrapped in blockquote tags</p> <p>and this too</p> </blockquote><p>but not this</p>')
示例7: test_h1
def test_h1(self):
'''
Lines starting with # should be wrapped in 'h1' tags
'''
self.assertEqual(
run_markdown('#this should be wrapped in h1 tags\n'),
'<p><h1>this should be wrapped in h1 tags</h1></p>')
示例8: test_em
def test_em(self):
'''
Lines surrounded by asterisks should be wrapped in 'em' tags
'''
self.assertEqual(
run_markdown('*this should be wrapped in em tags*'),
'<p><em>this should be wrapped in em tags</em></p>')
示例9: test_BlockQuotes
def test_BlockQuotes(self):
'''
Lines surrounded by double asterisks should be wrapped in 'H1' tags
'''
self.assertEqual(
run_markdown('>this should be wrapped in blockquotes\nthis should not be'),
'<p><blockquote>this should be wrapped in blockquotes</p>\n<p>this should not be</p>')
示例10: test_H1
def test_H1(self):
'''
Lines surrounded by double asterisks should be wrapped in 'H1' tags
'''
self.assertEqual(
run_markdown('#this should be wrapped in H1 tags'),
'<p><h1>this should be wrapped in H1 tags</h1></p>')
示例11: test_em
def test_em(self):
"""
Lines surrounded by asterisks should be wrapped in 'em' tags
"""
self.assertEqual(
run_markdown("*this should be wrapped in em tags*"), "<p><em>this should be wrapped in em tags</em></p>"
)
示例12: test_blockquote
def test_blockquote(self):
'''
Lines starting with >
'''
self.assertEqual(
run_markdown('> this should be wrapped in blockquote tags\r\n>hi'),
'<blockquote>\r\n<p> this should be wrapped in blockquote tags</p> <p>hi</p> </blockquote>')
示例13: test_Block
def test_Block(self):
'''
Lines preceded by the more than symbol(>) should be wrapped in 'blockquote' tags
'''
self.assertEqual(
run_markdown('>this should be wrapped in blockquote tags'),
'<p><blockquote>this should be wrapped in blockquote tags\n</blockquote></p>')
示例14: test_H3
def test_H3(self):
'''
Lines preceded by three pound symbols(###) should be wrapped in 'h3' tags
'''
self.assertEqual(
run_markdown('###this should be wrapped in h3 tags'),
'<p><h3>this should be wrapped in h3 tags</h3></p>')
示例15: test_H2
def test_H2(self):
'''
Lines preceded by two pound symbols(##) should be wrapped in 'h2' tags
'''
self.assertEqual(
run_markdown('##this should be wrapped in h2 tags'),
'<p><h2>this should be wrapped in h2 tags</h2></p>')