Generate Markdown files
Ever wondered how to DRY (Don’t Repeat Yourself) in a README.md
file? Or generate contents in any Markdown file? As it turns out, it’s quite simple.
Table of contents
Markdown & JavaScript file
Create a Markdown file as usual. Then in the places where you want to have generated contents, put:
Where foo
is the name of your function. You can have many functions, and you put them all in a complementary JavaScript file:
Because it’s a regular JavaScript file, you can include all files from your projects and generate contents with e.g. settings, default values, API functions, CLI parameters, etc.

Timeline Creator
Create and export timeline graphs using an online tool
It is also possible to include the JavaScript code directly in the mmd
blocks and get rid of the supporting JavaScript file.
Generator
First, install the mmarkdown npm package as a devDependency.
As part of your build process, run mmarkdown
. In the simplest case, it can be a separate npm
script. Also include the configuration in package.json
: