Reputation: 279
My purpose is to collect many descriptions written in markdown to a single markdown file for an integrated article.
For instance, in ./f1/a.md
This is the description for f1 project.
and in ./b.md
The introduction of f1 project is shown below,
<!-- Contain of the a.md goes here -->
The expected result of the b.md should be,
The introduction of f1 project is shown below,
This is the description for f1 project.
So, how can I achieve this function?
Upvotes: 3
Views: 708
Reputation: 136984
Markdown itself doesn't support file inclusions, but depending on the Markdown processor you are using you've got a couple of options:
Some Markdown processors support multiple input files. For example, Pandoc can take multiple input files and generate a single output file:
pandoc -o output.html one.md two.md three.md
You could simply concatenate your individual source files together in the correct order, then use that concatenated file as a single input for a less flexible parser:
cat one.md two.md three.md > source.md
markdown source.md
If you are on Windows you will probably need to replace cat
with type
.
Depending on the complexity of your input, you may want to automate this process. A tool like make
could help with this.
Upvotes: 2