def readme():
"""
Reads the readme file and converts it to RST if pypandoc is
installed. If not, the raw markdown text is returned
:return: the readme file as a string
"""
# noinspection PyBroadException
try:
# noinspection PyPackageRequirements,PyUnresolvedReferences
import pypandoc
with open("README.md") as f:
# Convert markdown file to rst
markdown = f.read()
rst = pypandoc.convert(markdown, "rst", format="md")
return rst
except ModuleNotFoundError:
# If pandoc is not installed, just return the raw markdown text
with open("README.md") as f:
return f.read()
评论列表
文章目录