Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created November 4, 2025 04:08
Show Gist options
  • Save Chubek/39792620290f02b4d3fb4fd6a710f2f7 to your computer and use it in GitHub Desktop.
Save Chubek/39792620290f02b4d3fb4fd6a710f2f7 to your computer and use it in GitHub Desktop.
cc-dossier
# Defined in /home/chubakpdp11/.config/fish/functions/cc-dossier.fish @ line 1
function cc-dossier
set -l mdfnm "$(basename $PWD).md"
set -l htmlfnm "$(basename $PWD).html"
test -f "$mdfnm" && rm "$mdfnm"
for mdf in ch*-*.md
cat "$mdf" >> "$mdfnm"
echo >> "$mdfnm"
echo "---" >> "$mdfnm"
echo >> "$mdfnm"
end
sed -i -E 's/^[ \t]*[*+-]+.+$/\n&/g' "$mdfnm"
sed -i -E 's/^[1-9]+\..+$/\n&/g' "$mdfnm"
sed -i -E 's/^[│├┤┤┘┌]/\n&│/g' "$mdfnm"
sed -i -E 's/^[ \t]# /# /g' "$mdfnm"
sed -i -E 's/^[ \t]```/```/g' "$mdfnm"
sed -i -E 's/\\\textsc/\\\text/g' "$mdfnm"
pandoc "$mdfnm" --standalone \
--shift-heading-level-by=1 \
--toc --toc-depth=4 \
--template=$DOSSIERS_STATIC_RESOURCE_DIR/template.html \
--metadata title="Dossier - $(basename $PWD)" \
--mathml \
-o "$htmlfnm"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment