This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
forked from navdeep-G/samplemod
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexample.py
71 lines (60 loc) · 2.34 KB
/
example.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import markdown_generator as mg
if __name__ == '__main__':
with open('example.md', 'w') as f:
writer = mg.Writer(f)
writer.write('write()')
writer.writeline()
writer.writeline()
writer.writeline('writeline()')
writer.writelines([
'writelines()1',
'writelines()2'
])
writer.write_hrule()
writer.write_heading('heading1')
for i in range(2, 7):
writer.write_heading('heading{}'.format(i), i)
writer.writeline(mg.emphasis('emphasis'))
writer.writeline(mg.strong('strong'))
writer.writeline(mg.strikethrough('strikethrough'))
unordered = mg.List()
unordered.append('unordered1')
unordered.append(mg.emphasis('unordered2'))
unordered.append('unordered3')
writer.write(unordered)
ordered = mg.List(ordered=True)
unordered.append('ordered1')
unordered.append(mg.emphasis('ordered2'))
unordered.append('ordered3')
writer.write(ordered)
checklist = mg.CheckList()
checklist.append('checklist1')
checklist.append('checklist2', True)
writer.write(checklist)
link = mg.link('https://reddit.com', 'link text')
writer.writeline(link)
image = mg.Image(('https://github.com/adam-p/markdown-here/'
'raw/master/src/common/images/icon48.png'),
'my alt text')
writer.writeline(image)
code = mg.Code('Python')
code.append("s = 'Python syntax highlighting'")
code.append("print(s)")
writer.write(code)
writer.writeline()
table = mg.Table()
table.add_column('col1')
table.add_column('col2', mg.Alignment.CENTER)
table.add_column('col3', 2)
for i in range(3):
table.append(*['e{}f{}'.format(i, j) for j in range(3)])
table.append()
table.append(mg.strong('e5f1'), image)
writer.write(table)
blockquote = mg.BlockQuote()
blockquote.append('A great man once said...')
blockquote.append('- Wayne Gretzky')
writer.write(blockquote)
blockquote2 = mg.BlockQuote(level=2)
blockquote2.append('- Michael Scott')
writer.write(blockquote2)