mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
27 lines
488 B
Bash
Executable file
27 lines
488 B
Bash
Executable file
#!/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
|