Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read the docs search isn't working - convert to restructured text #361

Open
Aylr opened this issue Sep 4, 2017 · 0 comments
Open

Read the docs search isn't working - convert to restructured text #361

Aylr opened this issue Sep 4, 2017 · 0 comments
Assignees

Comments

@Aylr
Copy link
Contributor

Aylr commented Sep 4, 2017

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
@Aylr Aylr self-assigned this Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant