Created
July 26, 2021 09:07
-
-
Save jnduli/0d07305c79c542282d105c48e31d004c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gen_html () { | |
mkdir -p test_compile | |
file_name=$1 | |
name="${1%.*}" | |
ext="${1##*.}" | |
echo "[${name}](./${name}.html)" >> index.md | |
echo "" >> index.md | |
pandoc -f markdown -t html --mathjax --metadata title="questions" -s -o ./test_compile/${name}.html $file_name | |
} | |
export -f gen_html | |
rm index.md | |
touch index.md | |
echo "%Index of Questions" >> index.md | |
find . -maxdepth 1 -type f -name "*.md" -printf "%f\n" | sort | xargs -I % bash -c 'gen_html "$@"' _ % | |
pandoc -f markdown -t html --mathjax -s -o ./test_compile/index.html index.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment