Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to split markdown files into several files and then compile with pandoc? #355

Open
exislow opened this issue Aug 4, 2023 · 2 comments

Comments

@exislow
Copy link

exislow commented Aug 4, 2023

If you write a book your *.md document gets pretty long. It makes sense, e.g. to create a main.md, which include several other markdown files, wheres each included file contains a chapter of the book.

Is this template capable of this?

@cagix
Copy link
Contributor

cagix commented Aug 4, 2023

something like pandoc -t pdf --template=https://github.com/Wandmalfarbe/pandoc-latex-template/blob/master/eisvogel.tex main.md chap1.md chap2.md chap3.md -o paper.pdf should work out of the box ... if you really want "includes", check out this Lua filter for Pandoc: https://github.com/pandoc/lua-filters/tree/master/include-files

@GregoryKogan
Copy link

This is great, but can be a little excessive in some cases. I found, that the easiest way of merging multiple markdown files together is just by grabbing them with glob like this:

pandoc src/*.md -o paper.pdf

Glob sorts files lexigraphically, so your src directory should look something like this:

src
├── 0-prologue.md
├── 1-chapter.md
├── 2-chapter.md
└── 3-chapter.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants