diff --git a/dot_config/private_fish/functions/md2html.fish b/dot_config/private_fish/functions/md2html.fish new file mode 100644 index 0000000000000000000000000000000000000000..18b68edc5b5b349974d62caffccc0ac227a9b7b9 --- /dev/null +++ b/dot_config/private_fish/functions/md2html.fish @@ -0,0 +1,27 @@ +function md2html + set NAME (eow) + set DIR ~/Downloads/tmp/responses + set FILENAME "$DIR/$NAME.md" + + mkdir -p $DIR + cat > $FILENAME + + cd $DIR + + if not prettier -w --parser markdown --prose-wrap always --no-editorconfig --no-config "$NAME.md" + echo "Error: prettier failed" >&2 + return 1 + end + + if not pandoc -so "$NAME.html" "$NAME.md" + echo "Error: pandoc failed" >&2 + return 1 + end + + if not xdg-open "$NAME.html" + echo "Error: xdg-open failed" >&2 + return 1 + end + + echo "Successfully created and opened $NAME.html" +end