Closed
Description
Is your feature request related to a problem? Please describe.
Many Python repositories have a structure similar to:
project/
docs/
conf.py
index.rst
src/
README.md
This README is perfect for writing the project's introduction and some minimal usage examples. GitHub also renders these README's on the landing page (not when in the docs folder). This README is often in the format of Markdown, because in multi-contributer projects, this is the most familiar format.
Good documentation includes an introduction, which the README is perfect for, but currently you cannot include this README in the toctree, because it is outside the docs/
folder.
Describe the solution you'd like
One of the following:
- Allow toctree parsing of source files outside the Sphinx project (which allows the extension
recommonmark
to parse the Markdown formatted README.md) - Allow passing on of a
.md
file to an extension before trying to parse the file as reST with the.. include:: ../README.md
statement.
Describe alternatives you've considered
- Use
.. include:: ../README.md
in areadme_link.rst
file (also mentioned in issue: ..include:: statement doesn't parse markdown files correctly #2840).
Problem: Parses the.md
file as reST - Add paths to
sys.path
inconf.py
like:sys.path.insert(0, os.path.abspath('..'))
Problem: Somehow this doesn't work for me - Use a symlink to the
README.md
Problem: Is not cross-platform (does not work on Windows) - Copy the file on
make
time with a function.
Problem: Far from ideal, needlessly making files. - Use M2R with
.. mdinclude:: ../README.md
; Only option working for me.
Problem: Usingextensions = ['m2r', 'recommonmark']
(or reversed list) gives the error:source_suffix '.md' is already registered
in them2r
library.
Additional context
- Similar issue can be found here: ..include:: statement doesn't parse markdown files correctly #2840 (but the difference is that this solution doesn't request Markdown parsing from Sphinx's side with
.. include::
, only to give extensions an interface to do so). - Similar issue on the extension
recommonmark
to support Markdown files outside the toctree directory: Support for ..include to parse Markdown files (README.md in parent dir) readthedocs/recommonmark#191