Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save atelierbram/09c8fb742f1518f09ff9e4338ab8f7fb to your computer and use it in GitHub Desktop.
Save atelierbram/09c8fb742f1518f09ff9e4338ab8f7fb to your computer and use it in GitHub Desktop.
Convert markdown files to html with Pandoc

Convert Markdown to html+css with Pandoc

Convert single markdown file to html from commandline:

  pandoc -f markdown -t html5 -o output.html input.md -c style.css

Convert multiple markdown files

Make a file with sh extension, like io.sh with content like:

#!/bin/bash -x

# write to file
overwrite_to_file()
{
 pandoc -f markdown -t html5 -o "ouptut-1.html" "input-1.md" -c "style.css"
 pandoc -f markdown -t html5 -o "ouptut-2.html" "input-2.md" -c "style.css"
 }

# execute it
overwrite_to_file 

Make executable from commandline like:

chmod +x io.sh

To use the script to convert multiple markdown files to multiple html files with this executable bash script from the commandline: type "io.sh" in the terminal and hit ENTER

@atelierbram
Copy link
Author

From the manual

@ssbozy
Copy link

ssbozy commented Apr 13, 2020

A quick update: I was using the above command and nothing was happening. After going over the pandoc docs, I added -s and seems to work. Maybe you can check as well?
pandoc -s -f markdown -t html5 -o output.html input.md -c style.css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment