-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.py
58 lines (34 loc) · 1.19 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
from markdown_worker import MarkdownParser
parser = MarkdownParser(filename="example.md")
test_url = "https://example.com/sample.md"
fetch_result = parser.fetch_markdown_from_url(test_url)
print("\nFetching Markdown from URL:")
print(fetch_result)
backup_result = parser.backup_markdown_file("example_backup.md")
print("\nBackup Result:")
print(backup_result)
stats = parser.get_statistics()
print("\nMarkdown File Statistics:")
print(stats)
html_output = parser.markdown_to_html()
print("\nConverted HTML:")
print(html_output)
blockquote_test = parser.search_heading("Blockquote Example")
print("\nBlockquote Test:")
print(blockquote_test)
hr_test = parser.search_heading("Horizontal Rule Example")
print("\nHorizontal Rule Test:")
print(hr_test)
table_test = parser.search_heading("Table Example")
print("\nTable Test:")
print(table_test)
image_test = parser.search_heading("Image Example")
print("\nImage Test:")
print(image_test)
link_test = parser.search_heading("Link Example")
print("\nLink Test:")
print(link_test)
replace_result = parser.find_and_replace("OpenAI", "Markdown Parser")
print("\nFind and Replace Test:")
print(replace_result)
parser.preview_html("test_preview.html")