I have a folder structure like this, with recipe .md files in directories according to theme:
Recipes
|- Mains
| |- recipe1.md
| |- recipe2.md
|- Desserts
|- recipe3.md
|- recipe4.md
How can I compile all these markdown files into a single PDF book?
I need each recipe to occupy a separate page, with titled sections (chapters) defined by the folders in which recipes are found. I would also like a table of contents with each recipe name, what page it's on and what chapter it is in.
Can I do this using pandoc and LaTeX? Or maybe a command line programme to construct wikis?
Best Answer
I assume your
recipeX.md
files already have headlines by themselves? And they are all at level 2?Then a small series of (Linux or macOS) shell command (or a little script) like the following should work (use the most recent version of Pandoc!):
Warning: do not miss the last
'-'
in the code above!If your
recipeX.md
files do NOT have headlines, try this variation: