#!/bin/bash
shopt -s globstar   # Enable recursive globbing

markdown_files=(chapters/**/*.md)

IFS=$'\n'
sorted_files=($(sort <<<"${markdown_files[*]}")); 
unset IFS

echo "${sorted_files[@]}"
MERMAID_FILTER_FORMAT=pdf pandoc -V colorlinks=true -V linkcolor=black -V urlcolor=black -f 'markdown+autolink_bare_uris' --pdf-engine=lualatex --pdf-engine-opt=-shell-escape --filter mermaid-filter --lua-filter columns.lua --citeproc -s "${sorted_files[@]}" -o ./out/bachelor.pdf -V lang=de-DE -V fontsize=11pt --highlight-style tango --reference-links --bibliography Bachelor.bib --csl=harvard-right.csl -M lang:de --number-sections