Skip to content

Instantly share code, notes, and snippets.

@michel47

michel47/panpandoc.sh

Last active Apr 1, 2021
Embed
What would you like to do?
pandoc with fronmatter evaluated with markdown directly ...
#
# problem:
# using $variable$ within a markdown file and have pandoc evaluate them using the frontmatter
# solution:
# run pandoc twice using the file itself as template
# usage:
# sh panpandoc.sh markdownfile.md [outputfile.html]
intent="script to have frontmatter variables evaluated using pandoc"
md=$1
if [ "o$2" != 'o' ]; then
out=$2
else
out=${md%.*}.html
fi
pandoc -t markdown --template=$md $md | pandoc -s -f markdown -o $out
exit $?
true; # $source: /my/shell/scripts/panpandoc $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment