Markdown Cheat Sheet

The majority of the pages that make up this website are written in markdown (a lightweight markup language created by John Gruber) before being converted to hypertext markup language (HTML) using Hugo (

I used to use Pandoc, a command-line tool designed to convert almost any document type, from or to any other type. For example, HTML to Word (.docx), spreadsheets to portable document format (PDF), or in my case, markdown to HTML.

This article serves as a basic reference guide — a cheat sheet — for using markdown. I’ll also include a few useful Pandoc commands.

Figure 1: The Markdown mark by Dustin Curtis

Markdown elements

The following are the common features or elements of markdown that I use all the time.

Document Title

title: 'Document title'


## Heading 2
### Heading 3
#### Heading 4

The title will be converted to heading 1.

[Click here](


Adding an image is almost the same as adding a hyperlink:

![Alt text](


The Pandoc command I use most often is pandoc --template=pandoc-template.html -o $filename.html $ In fact, I use it as part of a bash script, to generate multiple HTML documents at once:


rm articles.list # this file will be created by the script

# loop through each directory in articles, and loop through each .md file
for directory in `ls articles`; do
	for mdfile in `ls articles/$directory/*.md`; do
		filename=$(echo $mdfile | awk -F "." '{print $1}');
		echo $filename;
		pandoc --template=pandoc-template.html -o $filename.html $
		# get article title
		title=$(head --lines=2 $mdfile | awk -F "'" '{print $2}');
		echo $title,$filename.html >> articles.list

# create list of links and redirect to
cat articles.list | awk -F "," '{print "* ["$1"]("$2")"}' >;

# combine and in
cat >

# create the home page:
pandoc --template=pandoc-template.html -o home.html;

# WARNING! copy entire directory to /var/www/html/
# This is used for test purposes only

sudo cp -r * /var/www/html/