How to concatenate multiple markdown files in a specific order in Windows

Viewed 2701

I can easily do this in LINUX using an includes.txt file:

pandoc -s $(cat includes.txt) -o index.html

where includes.txt contains:

file1.md
file3.md
file2.md

The problem is that I now have to do the equivalent in Windows and cannot figure out how to concatenate the Markdown files in the order specified in the includes.txt file and then pass this to Pandoc.

Any help is appreciated.

2 Answers

You could create a file defaults.yaml with the following content:

input-files:
  - file1.md
  - file3.md
  - file2.md

Then call pandoc with pandoc --defaults defaults.yaml ….

After a short research, I found that you can do the equivalent operation in Windows environment using Pandoc.

Download and install Pandoc using the following link. You should select pandoc-2.9.2-windows-x86_64.msi

Pandoc

After successful installation of Pandoc, open powershell to check if the program is successfully installed by running the following command.

pandoc --version

Now, running the provided command from your original post will work in Windows environment.

pandoc -s $(cat includes.txt) -o index.html
Related