Last active
January 24, 2023 08:15
-
-
Save alexmwalker/35ff1c56e24a461c18b2b945b1feb4d2 to your computer and use it in GitHub Desktop.
This shell script takes any markdown file in the same folder and creates an Indesign-ready ICML file conversion in a new folder called 'icml'. You can then PLACE that ICML file into an Indesign Template. The idea is that your template file should already have all your Paragraph, Character and Graphic styles ready. Note that your ICML file remain…
This file contains hidden or 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 | |
set -e | |
declare -r out_dir="./icml" | |
declare -r old_ifs=${IFS} | |
declare f | |
declare filename | |
if ! command -v pandoc >/dev/null | |
then | |
echo "Install pandoc first." 1>&2 | |
exit 1 | |
fi | |
if [ ! -d "${out_dir}" ] | |
then | |
mkdir -p "${out_dir}" | |
fi | |
IFS=$'\n' | |
for f in *.md | |
do | |
filename="${f%.*}" | |
echo "Converting ${f} to ${filename}.icml" | |
pandoc -s -f markdown -t icml -o "${out_dir}/${filename}.icml" "${filename}.md" | |
done | |
IFS=${old_ifs} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Alex!
Thanks for sharing. I tried to execute the file using bash command and found the following errors.
Any solution, please?