fs.readdirSync("./").filter(f => f.toLowerCase().endsWith(".json")).forEach(function(markdownJson) {
markdownInclude.compileFiles(markdownJson).then(function () {
console.info(markdownJson + ' have been built successfully');
})
});
Example:
There are 3 JSON files in the directory with different files for compilation. But some of the MD files are reused in different compiled MD files.
1st.md content
#include my.md
2nd.md content
#include my.md
#include my2.md
3rd.md content
#include my.md
#include my3.md
my2.md content
some content about my2.
#include my3.md
every MD file has it's own unique Heading with !heading tag for inclusion into TOC.