I would like to include my project's README.md
into my Sphinx documentation like in
Can sphinx link to documents that are not located in directories below the root document?
- which is that in the resulting Sphinx html documentation I click on a link in the table of contents on the welcome page and get to the README.md
.
For that a document readme_link.rst
is created which contains the lines
Readme File
-----------
.. include:: ../../README.md
and I add the line
README <readme_link>
into the toctree of index.rst
.
Going with that, my README.md
is not parsed as Markdown, but just printed onto the page as-is-text.
I thought an alternative idea might be to have a markdown file readme_link.md
instead, but there is no way to include files with markdown.
How can I have my README.md parsed as markdown?
(Of course I don't want to rewrite it as .rst.)
Why m2r is not working
I tried to follow Render output from markdown file inside .rst file, but this is not working. My README.md
has some headings like
# First heading
some text
## Second heading 1
some text
## Second heading 2
some text
and I get the error WARNING: ../README.md:48: (SEVERE/4) Title level inconsistent:
. I understand from What does "Title level inconsistent" mean? that I need to use other symbols - but reading into them I realized that the answer refers to rst
symbols. That would mean that my markdown readme actually wasn't transformed into rst
.
PS: Someone else who tried something like that is https://muffinresearch.co.uk/selectively-including-parts-readme-rst-in-your-docs/