Closed yasirroni closed 2 years ago
The function you are using has as its input a str
and returns as its output a str
.
In [3]: cmarkgfm.github_flavored_markdown_to_html("# Hello\nworld")
Out[3]: '<h1>Hello</h1>\n<p>world</p>\n'
Your question appears to be a more general question about python file handling or paths and I think you will have to debug this on your own. At least I don't see how I can help you with that from here. As a tip, I think you may find this tutorial on the pathlib
module to be helpful.
Best of luck.
Nope, the problem is not in Python paths, but on the non existence of .css
to create the GitHub flavored markdown style of html file.
It seems that this package did not support that part? Thus, it only convert markdown into plain html file?
Correct, you must supply the css yourself. You must also supply any surrounding markup yourself.
TEMPLATE = """
<html lang="en">
<head>
<title>My Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>{html_content}</body>
</html>
"""
html_content = cmarkgfm.github_flavored_markdown_to_html(text)
html = TEMPLATE.format(html_content=html_content)
Feature request: warp all that for user. :)
You can look other implementation on github.css in markdown-viewer that come with MIT License.
Out of scope. Best of luck.
Using
produce nothing.
Adding
Create plain html format