Skip to content

Instantly share code, notes, and snippets.

@ianpaul
Created April 15, 2020 11:14
Show Gist options
  • Save ianpaul/0be759a233d7a2fa9ceac2a4f948bc49 to your computer and use it in GitHub Desktop.
Save ianpaul/0be759a233d7a2fa9ceac2a4f948bc49 to your computer and use it in GitHub Desktop.
Convert markdown to HTML in Bash
#!/bin/bash
# A simple Bash script to create HTML in stdout from a markdown file
# This script requires pandoc. On Ubuntu use `sudo apt install pandoc` to install.
# Check to see if the user included a filename. If not, ask them for one.
if [ -z "$1" ]; then
read -p "Please provide a filename (include the path if not in this directory): " file
else file=$1
fi
# Execute this 'pandoc' command to create HTML from markdown and display in stdout for copying
pandoc -f markdown $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment