forked from ryneeverett/python-markdown-comments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
36 lines (31 loc) · 877 Bytes
/
example.py
File metadata and controls
36 lines (31 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import markdown
import mkdcomments
comments = mkdcomments.CommentsExtension()
markdowner = markdown.Markdown(extensions=[comments])
test = markdowner.convert("""\
markdowntext1 <!---inline comment-->
<!---this line is ommitted entirely-->
markdowntext2 <!---multiline comment
multiline comment
multiline comment-->markdowntext3
<!---inline comment-->markdowntext4<!---inline comment-->
<!---inline comment-->markdowntext5<!---multiline commment
multiline comment-->
<!---multiline comment
multiline comment-->markdowntext6<!---unsupported comment-->
<!---multiline comment
multiline comment-->markdowntext7<!---multiline comment
multiline comment-->
""")
"""
Results:
>>> import example
>>> print example.test
<p>markdowntext1</p>
<p>markdowntext2</p>
<p>markdowntext3</p>
<p>markdowntext4</p>
<p>markdowntext5</p>
<p>markdowntext6</p>
<p>markdowntext7</p>
"""