Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tianyeeee/f547cd58159a6a3ba66d113c4c199ef8 to your computer and use it in GitHub Desktop.
Save tianyeeee/f547cd58159a6a3ba66d113c4c199ef8 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

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