1

I'm assembling a book with individual chapters constructed as markdown files with Pandoc. Currently, I'm successfully using a script like this to combine the metadata document with the chapters to create an ePub document:

pandoc -o book.epub metadata.yaml \  
        chapters_markdown/chapter_01.md \
        chapters_markdown/chapter_02.md \
        chapters_markdown/chapter_03.md \
        chapters_markdown/chapter_04.md

However, between several chapters, I would like to additionally like to group several chapters together into parts, similar to the way you would use the LaTeX commands:

\part{First part}
\chapter{First chapter}
\chapter{Second chapter}
\part{Second part}
\chapter{Third chapter}
\chapter{Fourth chapter}

Is there any way to do this with markdown and Pandoc?

nxl4
  • 714
  • 2
  • 8
  • 17
  • pandoc behaves the same regardless how you split your input files. what matters is that you use the right headers, i.e. `# header1` and `## header2`... – mb21 Oct 09 '20 at 07:23
  • @mb21, the LaTeX `part` header is higher order than a Markdown `# chapter` header. There is no direct Markdown equivalent that I'm aware of, so I'm wondering what the best way to do this is. – nxl4 Oct 11 '20 at 16:16
  • 1
    using https://pandoc.org/MANUAL.html#option--top-level-division ? – mb21 Oct 12 '20 at 06:55
  • OK, that makes a little more sense. Thanks! – nxl4 Oct 13 '20 at 21:20
  • @nxl4 I'm going down this exact path, including parts, and don't have my yaml file or scripts yet. I don't suppose you have a GitHub repo you could share? – buttonsrtoys Mar 19 '23 at 13:42

0 Answers0