#!/bin/sh set -eu INFILE=$1 OUTFILE="$(dirname "$INFILE")/${2:-index.qmd}" if command -v quarto > /dev/null 2>&1; then PANDOC="quarto pandoc" else PANDOC=pandoc fi # use intermediary file (cannot use pipe with quarto wrapper) # TODO: maybe add --fail-if-warnings $PANDOC --to commonmark+smart+yaml_metadata_block --standalone --wrap none --output "$OUTFILE"~ "$INFILE" perl -pe 's/ --- / -- /g; s/\\(?=['"'"'"])//g; s/^- / * /g;' < "$OUTFILE"~ > "$OUTFILE" rm "$OUTFILE"~