Commit ce7e3855 authored by gaojiuli's avatar gaojiuli

Add <strong> support

parent 8981046f
from tomd import Tomd
import tomd
from tomd import Tomd
string = """
<h1>h1</h1>
<h2>h2</h2>
......@@ -29,6 +30,8 @@ string = """
<b>bold</b>
<i>italic</i>
<b><i>bold italic</i></b>
<em>em</em>
<strong>strong</strong>
</p>
<hr/>
......@@ -49,6 +52,7 @@ string = """
<td>td</td>
<td>td</td>
</tr></tbody></table>
"""
print(Tomd(string).markdown)
......
......@@ -15,6 +15,7 @@ MARKDOWN = {
'li': ('- ', ''),
'blockquote': ('\n> ', '\n'),
'em': ('**', '**'),
'strong': ('**', '**'),
'block_code': ('\n```\n', '\n```\n'),
'span': ('', ''),
'p': ('\n', '\n'),
......@@ -66,7 +67,8 @@ INLINE_ELEMENTS = {
'li': '<li.*?>(.*?)</li>',
'img': '<img.*?src="(.*?)".*?>(.*?)</img>',
'a': '<a.*?href="(.*?)".*?>(.*?)</a>',
'em': '<em.*?>(.*?)</em>'
'em': '<em.*?>(.*?)</em>',
'strong': '<strong.*?>(.*?)</strong>'
}
DELETE_ELEMENTS = ['<span.*?>', '</span>', '<div.*?>', '</div>']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment