mirror of
https://github.com/notwa/rc
synced 2024-06-26 09:07:12 -07:00
add ghmd command: github markdown
via leah
This commit is contained in:
parent
56a5724160
commit
936bb919ed
24
sh/ghmd
Normal file
24
sh/ghmd
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env zsh
|
||||
# ghmd - format GitHub markdown
|
||||
# via: https://leahneukirchen.org/dotfiles/.zshrc
|
||||
# example: ghmd < README.md > README.html
|
||||
# YES_ZSH
|
||||
# YES_BASH
|
||||
# YES_DASH
|
||||
|
||||
ghmd() {
|
||||
# CSS via: https://github.com/sindresorhus/github-markdown-css
|
||||
# <link href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css" 'media="all" rel="stylesheet" type="text/css" />
|
||||
printf '%s' '<!DOCTYPE html><html><head><meta charset="utf-8"><link ' \
|
||||
'href="https://eaguru.guru/t/github-markdown.css" ' \
|
||||
'media="all" rel="stylesheet" type="text/css"/></head><body ' \
|
||||
'style="box-sizing: border-box; min-width: 200px; max-width: 980px; ' \
|
||||
'margin: 0 auto; padding: 45px;"><article class="markdown-body">'
|
||||
curl -s --data-binary @- -H 'Content-Type: text/plain' \
|
||||
https://api.github.com/markdown/raw
|
||||
local ret=$?
|
||||
printf '%s' '</article></body></html>'
|
||||
return $ret
|
||||
}
|
||||
|
||||
[ "${SOURCING:-0}" -gt 0 ] || ghmd "$@"
|
Loading…
Reference in New Issue
Block a user