healthcareai-py
healthcareai-py copied to clipboard
Read the docs search isn't working - convert to restructured text
Apparently there is an old known issue that RTD doesn't search markdown documents.
A known workaround is to convert .md files to .rst files before they are built by read the docs.
This code block I wrote once may help.
def convert_to_rst(filename):
"""
Nice markdown to .rst hack. PyPI needs .rst.
Uses pandoc to convert the README.md
From https://coderwall.com/p/qawuyq/use-markdown-readme-s-in-python-modules
"""
try:
import pypandoc
long_description = pypandoc.convert(filename, 'rst')
long_description = long_description.replace("\r", "")
except (ImportError, OSError):
print("Pandoc not found. Long_description conversion failure.")
import io
# pandoc is not installed, fallback to using raw contents
with io.open(filename, encoding="utf-8") as f:
long_description = f.read()
return long_description