Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tomd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Чумбаев Максим
tomd
Commits
ce7e3855
Commit
ce7e3855
authored
Jun 08, 2017
by
gaojiuli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add <strong> support
parent
8981046f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
test_tomd.py
test_tomd.py
+5
-1
tomd.py
tomd.py
+3
-1
No files found.
test_tomd.py
View file @
ce7e3855
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
)
...
...
tomd.py
View file @
ce7e3855
...
...
@@ -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>'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment