mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts] Add some of the legacy scripts
This commit is contained in:
parent
aeeda91fe7
commit
bb53d01244
4 changed files with 94 additions and 0 deletions
26
scripts/mkgist
Executable file
26
scripts/mkgist
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
FILE="$1"
|
||||
DEST="$2"
|
||||
|
||||
command_exists () {
|
||||
whence -- "$@" &> /dev/null
|
||||
}
|
||||
|
||||
if ( ! command_exists markdown2htmldoc ); then
|
||||
echo "md2htmldoc not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
filename=$(basename -- "$FILE")
|
||||
extension="${filename##*.}"
|
||||
filename="${filename%.*}"
|
||||
content=$(cat "$FILE")
|
||||
|
||||
md_content="# \`$filename.$extension\`\n\n\`\`\`$extension\n$content\n\`\`\`"
|
||||
|
||||
echo "$md_content" > temp.md
|
||||
|
||||
markdown2htmldoc temp.md "$DEST/$filename.$extension.html"
|
||||
|
||||
rm -rf temp.md
|
Loading…
Add table
Add a link
Reference in a new issue