I'm actually surprised that no one in this page has offered any HTML solutions. As far I have understood MarkDown files can include wide portion (if not all) of HTML tags. So follow these steps:
From here: put your MarkDown files in <span style="display:block"> ... </span>
tags to be sure they will be rendered as markdown. You have a whole lot of other style properties you can add. The one I like is the text-align:justify
.
From here: Include the files in your main file using the <iframe src="/path/to/file.md" seamless></iframe>
P.S.1. this solution does not work on all MarkDown engines / renders. For example Typora did render the files correctly but Visual Studio Code didn't. It would be great if others could share their experience with other platforms. Specially I would like to hear about GitHub and GitLab ...
P.S.2. On further investigation there seems to be major incompatibility issues leading to this not being properly rendered on many platforms, including Typora, GitHub and Visual Studio code. Please do not use this till I resolve them. I will not delete the answer just for the sake of discussion and if maybe you can share your opinions.
P.S.3. To further investigate this issue I have asked this questions here on StackOverflow and here on Reddit.
P.S.4. After some through study, I came to the conclusion that for the moment AsciiDoc is a better option for documentation. It comes with built-in include functionality, it is rendered by GitHub, and major code editors like Atom and vscode have extensions for live preview. One can use Pandoc or other tools to automatically convert existing MarkDown Code to AsciiDoc with minor changes.
P.S.5. Another lightweight markup language with built-in include functionality is reStructuredText
. It comes with .. include:: inclusion.txt
syntax by standard. There is ReText editor with live preview as well.