blob: 6505be75c1a415ade2303b07e94414ff9947c8be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/bin/bash
begin_of_html() {
cat > "$1" <<EOF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
html, body {
padding: 10px;
padding-left: 4%;
padding-right: 4%;
font-family: monospace;
font-size: 13px;
}
a {
text-decoration: none;
color: #ab2323;
font-size: 0.95em;
font-weight: bold;
}
h1 {
font-size: 32px;
padding:3px;
}
h2 {
border-bottom: 1px solid #dedede;
padding:1px;
}
</style>
</head>
<body>
EOF
}
_OUTFILE="$2"
_INFILE="$1"
main() {
begin_of_html "$_OUTFILE"
/usr/bin/markdown "$_INFILE" >> "$_OUTFILE"
echo "</body>" >> "$_OUTFILE"
}
case $1 in
--help|-h)
echo "$0 file.md out.html"
exit 0
;;
*)
if [[ $# -ne 2 ]]
then
echo "Invalid arguments!"
echo "$0 file.md out.html"
else
main
fi
exit 1
;;
esac
|