-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_html_from_readme.py
More file actions
61 lines (56 loc) · 1.4 KB
/
create_html_from_readme.py
File metadata and controls
61 lines (56 loc) · 1.4 KB
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
# filepath: convert_readme_to_html.py
import markdown
# Read the README.md file
with open("README.md", "r", encoding="utf-8") as md_file:
md_content = md_file.read()
# Convert Markdown to HTML
html_content = markdown.markdown(md_content)
# Add basic HTML structure
html_page = f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenSCADA Lite</title>
<style>
body {{
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
padding: 20px;
background-color: #f9f9f9;
color: #333;
}}
h1, h2, h3 {{
color: #0056b3;
}}
pre {{
background: #f4f4f4;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
}}
code {{
background: #f4f4f4;
padding: 2px 4px;
border-radius: 3px;
}}
a {{
color: #0056b3;
text-decoration: none;
}}
a:hover {{
text-decoration: underline;
}}
</style>
</head>
<body>
{html_content}
</body>
</html>
"""
# Write the HTML content to a file
with open("README.html", "w", encoding="utf-8") as html_file:
html_file.write(html_page)
print("README.md has been converted to README.html")