Search code examples
pythonpython-sphinxread-the-docs

Theme change using conf.py now ignores my .md files for the toctree when importing


I am moving a technical document over from GitHub/gitbook and using Sphinx on RTD, with default import with no sphinx files outside of an index.rst for toctree created and default settings in RTD it works fine, displays well and looks much better than previous, but the colours are wrong. When I add in a conf.py for theme options (have made the master look for index) into my GitHub project and then rebuild into RTD, the build is successful with great colours but now ignores my .md files so no toctree content. without conf.py I get a great layout but in wrong colours.

I feel like I have tried everything from going back to the base conf.py and leaving empty to a single file in the toctree, I have changed the file ext to .rst which works but does not reformat the .md. it simply seems to ignore the .md files

*Only changed code below from conf.py, index is the same doc as when it works

master_doc = 'index'
html_theme = "classic"
"rightsidebar": False,
"stickysidebar": True,
"collapsiblesidebar": True,
"externalrefs": True,
"footerbgcolor": 'white',
"footertextcolor ": 'darkslategrey',
"sidebarbgcolor": 'white',
"sidebarbtncolor": 'darkslategrey',
collapsiblesidebar is True).
"sidebartextcolor": 'darkgreen',
"sidebarlinkcolor":'green',
"relbarbgcolor": 'darkslategrey',
"relbartextcolor": 'white',
"relbarlinkcolor": 'white',
"bgcolor": 'white',
"textcolor": 'black',
"linkcolor": 'darkgreen',
"visitedlinkcolor": 'darkgreen',
"headbgcolor": 'white',*

All I want to achieve is to import my .md files and they are from a live doc, have them output using the classic theme with customised colours.


Solution

  • You must declare the source_suffix in your conf.py:

    source_suffix = {
        '.rst': 'restructuredtext',
        '.txt': 'restructuredtext',
        '.md': 'markdown',
    }
    

    You might also need to install and configure recommonmark. RTD supports it natively.