Is there a way to include Markdown files inside other Markdown?

I’ve searched this topic but could not find any solution to what it seems to be it should be a pretty common need.

I have several man pages of programs that share common options. For obvious reasons I would like to avoid having to copy the same text over and over again to each individual .md file (and change them the same number of times when something is updated). In RST one can simply .. include:: common but this seems not to be possible with Markdown.

Any solution for this?


Simplest solution would be to just preprocess the files using a template language like Mustache, though it’s not always the most ideal solution.

There appears to have been some discussion Transclusion or including sub-documents for reuse - #11 by chrisalley - Extensions - CommonMark Discussion about that kind of extension and there’s a kind of spec in GitHub - iainc/Markdown-Content-Blocks: File transclusion syntax for Markdown.. I’d consider accepting an extension to CommonMark.jl that supports this syntax if someone feels strongly about it and wants to take a stab at implementing it. It doesn’t look like it would be too difficult to implement. A thorough review of all the options and what’s most supported in the wild would be good to do prior to that.

@mike Thanks for the quick update on the situation but for me, only wanting to suffer horribly with docs, it seems easier to … drop Documenter and go back to RST.