Serve GitHub Flavored Markdown

I do not want to forget how to do this, so I’m writing it down now. To me this is important as I wrote manuals and training materials in markdown format, like in GitHub wiki.

The article is about how to serve markdown formatted files just like you browse it in GitHub, locally or when offline. The markdown files are written in GitHub Flavored Markdown (GFM).

Here goes the manual.

First, prepare your server or desktop, install npm.

apt-get install npm
ln -s /usr/bin/nodejs /usr/bin/node

Last, clone GFMS or GitHub Flavored Markdown Server repository from GitHub and compile it. There are several forks of GFMS, I chose this one: https://github.com/pawel-wiejacha/gfms

mkdir -p /opt/git
cd /opt/git
git clone https://github.com/pawel-wiejacha/gfms
cd gfms
npm install
ls -l bin/gfms

That is all, only 2 steps to install GFM server.

Here is how you use it.

For example I want to read this project, the VoIP ID Book Project, offline, my internet sucks or maybe its off, and I already clone the project locally in /opt/git/book-voip-id.

cd /opt/git/book-voip-id
/opt/git/gfms/bin/gfms -p 1122

Last command above will starts a web server at port 1122 which then you can browse it from a browser. Click on any .md files and you’ll see that those files rendered just like you view them on GitHub.