1

I am writing documentation and my single Markdown file has thousands of lines. As you probably guessed, this is not convenient to scroll and find the things you want.

Therefore, is it possible to have one Markdown file which displays other Markdown (chapter) files? At the end it is fine that this Markdown file displays thousands of lines, I just want to structure it using sub-Markdown files if you will.

This link discussed this back in 2011, do we have this capability now with Markdown files or still not?

user395980
  • 356
  • 1
  • 8

1 Answers1

1

There's no standardized "include" directive in Markdown. Some flavors might have way to include or merge multiple files but this will usually not work with most of widespread tooling and renderers (e.g. Github Pages).

If you don't mind extra step of building final file you can use some tool (like cat, m4 or similar) to put all files together when you are ready to release the document.

It really depends if having single file is a must for you; but breaking document down to multiple files each for one logical chapter or section is not uncommon and actually might be welcome by readers as well. You can soft-integrate multiple files simply by using hyperlinks (e.g. creating TOC document linking to all chapters, etc.)

blami
  • 6,588
  • 2
  • 23
  • 31