Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (46 sloc) 1.12 KB
#! /bin/bash
# Written by Ankit R. Gadiya
# Github Markdown css cdn: https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.6.0/github-markdown.min.css
input=$1
output=${1%.*}.html
title=${1%.*}
html ()
{
echo '
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>$title</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.6.0/github-markdown.min.css">
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
</style>
</head>
<body>
<div class="markdown-body">' >> $output
markdown $input >> $output
echo '
</div>
</body>
</html>' >> $output
}
if [ $# = 0 ]
then
echo "╦ ╦┌─┐┬ ┌─┐"
echo "╠═╣├┤ │ ├─┘"
echo "╩ ╩└─┘┴─┘┴ "
echo "A simple script to generate github flavoured pages from markdown"
echo "Usage: gm file.md"
elif [ $# = 1 ]
then
html
fi