You need to edit your readme_link.rst as follows:
Readme File
Please note that the section heading is indicated by = and not - .
Two factors contribute to this.
How to enable it works
The standard include (not mdinclude ) actually reads the contents of the source file and simply copies the raw text instead of the directive. M2R mdinclude first converts the Markdown source to rst , and then, like include , copies this test instead of the directive.
Thus, by the time the rst document is parsed, you have one full rst document from both parents and include files. This complete document should be a valid rst document, which brings us to the second point ...
Header levels must be consistent.
Recall that the reStructuredText specification explains:
Instead of overlaying a fixed number and style order for the section headings, the applicable order will correspond to the order that occurs. The first style encountered will be the external title (such as HTML H1), the second style will be the subtitle, the third will be the subtitle, and so on.
...
You do not need to use all section heading styles and you do not need to use any specific section heading style. However, the document must consistently use the section headings: once the hierarchy of heading styles is established, sections should use this hierarchy.
Therefore, the header levels in the included child must match the header levels in the parent. Since M2R generates an rst document, you (as the end user) do not understand which character is used to define each section level. Therefore, to maintain consistency, you need to use the circuit defined by M2R. Unfortunately, M2R does not document the scheme used (I filed an error report ). However, the schema is defined in the source code :
hmarks = { 1: '=', 2: '-', 3: '^', 4: '~', 5: '"', 6: '#', }
As you can see, level 1 headers use the symbol = and level 2 headers use the - symbol. Therefore, the same scheme must be used in the parent readme_link.rst file (you used the opposite).
Alternative solution
The reStructuredText specification also states:
Underlining decoration styles are different from underlining and underlining styles that use the same symbol.
This way you can use the styles of the parent document with underline and underline, and it doesn't matter which characters you used for which level, since M2R seems to use only underline styles. So this would work:
----------- Readme File ----------- .. mdinclude:: ../../README.md
This gives an additional advantage (or a negative one, depending on your point of view) that all headings in the included child document will now be one level lower than they are by themselves. Therefore, the child is more semantically “embedded” in the parent (more than one h1 in one HTML document is often considered not semantic, although technically it is “valid”). Of course, this may or may not be what you want, so it is marked as an “alternative solution”.