Created
October 1, 2013 23:12
-
-
Save quackingduck/6786676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Given some html (on stdin), wraps it in html that applies the same aesthetic | |
# that github uses for rendering markdown-processed content | |
# Usage: | |
# markdown < in.md | ghstyles > out.html | |
# If you have node.js installed I recommend the [marked] processor. It's fast, | |
# supports "github flavored" markdown by default and has no dependencies | |
# (other than node itself). | |
# [marked]:https://github.com/chjj/marked | |
header=`cat <<HTML | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<!-- Use Github's CDN for assets --> | |
<base href="http://github.global.ssl.fastly.net"> | |
<!-- Github stylesheet that includes styles for markdown formatted content --> | |
<link href="/assets/github-ae794206d0e4e8a84619ca476b2b906ec038d487.css" rel="stylesheet" type="text/css"> | |
<!-- Style article chrome --> | |
<style> | |
article { | |
margin: 64px auto; | |
box-sizing: border-box; | |
width: 910px; | |
padding: 30px; | |
border: 1px solid #ddd; | |
border-radius: 2px; | |
box-shadow: 0px 0px 2px #ddd; | |
} | |
</style> | |
</head> | |
<body> | |
<article class="markdown-body"> | |
HTML` | |
footer=`cat <<HTML | |
</article> | |
</body> | |
</html> | |
HTML` | |
echo "$header" | |
cat | |
echo "$footer" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment