Skip to content

Commit 355d196

Browse files
committed
v0.0.8
1 parent 2212257 commit 355d196

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

httpmdhtml/md_to_html.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ def markdown_to_html(
3131
# soup.select_one('meta').attrs['content'] = "no-cache"
3232
soup.select_one("head").append(soup.new_tag("style"))
3333
if css_file:
34-
with open(css_file, "r") as f:
35-
css = f.read()
34+
if css_file == "none":
35+
css = ""
36+
else:
37+
with open(css_file, "r") as f:
38+
css = f.read()
3639
else:
3740
css = """body { background-color: #272822; color: white; font-family: Courier; }
3841
a[href] { color: #66d9ef; }
@@ -81,7 +84,7 @@ def markdown_to_html(
8184
parser.add_argument(
8285
"--css_file",
8386
default=None,
84-
help="css-file-path; its content will be written to the <style> element",
87+
help='css-file-path whose content will be written to the <style> element. Can be "none"; do not use any css',
8588
)
8689
args = parser.parse_args()
8790

httpmdhtml/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def do_GET(self, rm_temp_html=False):
9090
parser.add_argument(
9191
"--css_file",
9292
default=None,
93-
help="css-file-path; its content will be written to the <style> element",
93+
help='css-file-path whose content will be written to the <style> element. Can be "none"; do not use any css',
9494
)
9595
parser.add_argument(
9696
"--live_md_rr",
@@ -115,7 +115,9 @@ def do_GET(self, rm_temp_html=False):
115115
MarkdownIt_obj = (
116116
MarkdownIt("commonmark").enable("table").enable("strikethrough")
117117
)
118-
if args.css_file and not os.path.isfile(args.css_file):
118+
if args.css_file and all(
119+
(args.css_file != "none", not os.path.isfile(args.css_file))
120+
):
119121
raise FileNotFoundError(
120122
f"looks like the given `css_file` argument's value - {args.css_file} - cannot be found"
121123
)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
setup(
88
name="httpmdhtml",
9-
version="0.0.7",
9+
version="0.0.8",
1010
license="gpl-3.0",
1111
author="John Hupperts",
1212
author_email="[email protected]",
1313
description="HTTP server that converts markdown to HTML",
1414
long_description=long_description,
1515
long_description_content_type="text/markdown",
1616
url="https://github.com/treatmesubj/python-md-to-html-server",
17-
download_url="https://github.com/treatmesubj/python-md-to-html-server/archive/refs/tags/v0.0.7.tar.gz",
17+
download_url="https://github.com/treatmesubj/python-md-to-html-server/archive/refs/tags/v0.0.8.tar.gz",
1818
packages=["httpmdhtml"],
1919
package_dir={"python-md-to-html-server": "httpmdhtml"},
2020
project_urls={

0 commit comments

Comments
 (0)