#!/usr/bin/env sh # ghmd - format GitHub markdown # via: https://leahneukirchen.org/dotfiles/.zshrc # example: ghmd < README.md > README.html # compat: +ash +bash +dash +hush -ksh +mksh +oksh +osh +posh +yash +zsh ghmd() { ### @- ### convert a markdown file to HTML in the style of GitHub. ### note that this uses GitHub's API, so it requires internet connectivity. ### ### this script utilizes the CSS provided at ### [sindresorhus/github-markdown-css.](https://github.com/sindresorhus/github-markdown-css) ### ### ``` ### ~/sh/ghmd < ~/rc/README.md > ~/rc/README.html ### ``` printf '%s' '
' curl -s --data-binary @- -H 'Content-Type: text/plain' \ https://api.github.com/markdown/raw local ret=$? printf '%s' '
' return $ret } [ -n "${preload+-}" ] || ghmd "$@"