blob: 0abe6ceb2927ee64828584bac2cb9f7206bc3147 (
plain)
- #!/bin/sh
- set -eu
- INFILE=$1
- OUTFILE="${2:-$(dirname "$INFILE")/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"~
|