I have a directory of .md documents that each contain a YAML header specifying document title
, author
, date
, categories
,tags
, etc. The directory contains journal entries and the filenames are simply the date of the entry.
I have no trouble using pandoc to generate a PDF for each .md file, however I'm looking for a way generate a single PDF in book or memoir format with each .md document's title
field as a chapter in the table of contents, arranged by the date
value. Ideally, the date
would also appear in the table of contents, but that's not critical if the individual chapters will also display that information.
I haven't been able to find a way to do this as pandoc seems to ignore all but the first YAML header when concatenating multiple documents. One possible solution I can think of is to convert all relevant YAML header info to markdown headings and then demote existing headings in each .md document. But I'm not sure how to do this or if this is even the best approach. I was also looking at the R bookdown
package, but it also uses markdown headers for chapters and not sure if it can be adapted to use YAML header info.
what is the easiest way to accomplish what I need? Thanks.