diff --git a/docs/bin/gfm2html b/docs/bin/gfm2html
index bf0a9faff..db293ab0d 100755
--- a/docs/bin/gfm2html
+++ b/docs/bin/gfm2html
@@ -1,65 +1,64 @@
-#!/usr/bin/env bash
-
-# Convert a Github Flavored Markdown Syntax file to HTML for the landing page
-# using CSS stylesheet and JS scripts
+#!/bin/bash
+
+# Convert a Github Flavored Markdown Syntax file to HTML
#
-# This script is highly based on the one of Evertton de Lima available on
-# https://gist.github.com/evertton/4133083
+# The MIT License (MIT)
+# Copyright © 2012 Evertton de Lima
+# http://evertton.mit-license.org/
+# Stylesheet feature by Dan Untenzu
#
# Requirements: cURL (sudo apt-get install curl)
# Input/Output: filename/STDOUT
#
-# Usage: gfm2html
+# Usage: gfm2html [stylesheet] > output
# * input: filename of the Github Flavored Markdown (GFM) syntax document
-# * output_dir: dirpath where the HTML documents have to be generate
+# * stylesheet: optional URI of a custom CSS document to style the output HTML
+# if none given the GitHub Markdown Styles are used as fallback
+# * output: filename of the HTML document to generate
#
-# eg: ./gfm2html README.md docs/
-set -e
-
-function format_text {
-text=$1
+# eg: ./gfm2html README.md http://gist.io/static/css/screen.css > readme.html
+
+# read markdown file
+if [ ! -n "$1" ]
+then
+echo "No file specified!"
+echo " gfm2html "
+elif [ -d "$1" ]
+then echo "$1 is a directory."
+elif [ ! -e "$1" ]
+then echo "The file $1 not exist!"
+elif [ ! -r "$1" ]
+then echo "The $1 file cannot be read! Verify the permissions!"
+else
+text=$(<"$1")
text=${text//\"/\\\"}
text=${text// /\\\t}
text=${text//
/\\\n}
-echo $text
-}
-function generate_html {
-result=$(curl --silent https://api.github.com/markdown -d "{\"text\": \"$1\", \"mode\": \"gfm\", \"context\": \"\"}")
-stringtosearch='"message": '
-if `echo $result | grep "$stringtosearch" 1>/dev/null 2>&1`
-then
- echo $result
- exit 1
-fi
-echo "$result"
-}
+# convert markdown to html using Github API v3
+result=$(curl --silent https://api.github.com/markdown -d "{\"text\": \"$text\", \"mode\": \"gfm\", \"context\": \"\"}")
-# read markdown file
-if [[ ! -n "$1" ]]; then
- echo "No input file specified!"
- exit 1
-elif [[ -d "$1" ]]; then
- echo "$1 is a directory."
- exit 1
-elif [[ ! -e "$1" ]]; then
- echo "The file $1 not exist!"
- exit 1
-elif [[ ! -r "$1" ]]; then
- echo "The $1 file cannot be read! Verify the permissions!"
- exit 1
+# output html
+printf '
+
+
+
+
+'
+
+# return default css if no stylesheet given
+if [ ! -n "$2" ]
+then
+echo ""
else
- doc=$(<"$1")
- formatted_doc=$(format_text "$doc")
+printf ""
fi
-
-if [[ ! -n "$2" ]]; then
- echo "No output file specified!"
- exit 1
+
+printf "\n
+
+%s
+
+" "$result"
+
fi
-
-rm docs/*.html
-generate_html "$formatted_doc" > tmp_html
-python docs/src/generate_html.py --html_content tmp_html --output_dir docs/
-rm tmp_html