markdown-include icon indicating copy to clipboard operation
markdown-include copied to clipboard

Duplicate TOC entries when compiling MD files from several JSONs in single JS

Open pharaoh1st opened this issue 5 years ago • 0 comments

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.

pharaoh1st avatar Feb 10 '21 09:02 pharaoh1st