본문 바로가기
Developing../Python

markdown to html file

by bents 2021. 1. 31.
import markdown

# Simple conversion in memory
# <iframe src="https://docs.google.com/presentation/d/e/2PACX-1vTSwu5CZBK-pZzpKXXUq8fuqOMBngCCtRv1LjnCETTnsLyQ5yxzQ1lxbCVDvSWT9lze1wEkiODRcqVK/embed?start=true&loop=false&delayms=3000" frameborder="0" width="960" height="569" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>


md_text = '''
### topic
1. Data
    - explain ....
> quotation
'''

html = markdown.markdown(md_text, extensions=['markdown.extensions.tables']) 
# 'fenced_code', 'codehilite',
Html_file= open("filename.html","w")
Html_file.write(html)
Html_file.close()
print(html)