2 ms·
I've been writing a lot recently. There's a bit of scaffolding around things going into a docs folder, some JS and CSS tweaks for the various output formats (e
by shakna 7y ago
I've been writing a lot recently.
There's a bit of scaffolding around things going into a docs folder, some JS and CSS tweaks for the various output formats (ePub, HTML & PDF), but there is a very simple script I use to reduce some friction whilst writing.
It's nice to have a lot of small files. However, you may often want to:
1. Rearrange those files
2. Insert a new section between two other files
So, I hacked together this incredibly tiny script that means anytime I want to add anything, I can immediately get to wherever I'm up to:
next="$(ag TODO docs | awk -F':' '{print $1}' | uniq | sort | head -n1)"
if [ -z "$next" ]
n="$(basename "$(find docs -type f | sort | tail -n1)" .md)"
n2="$(echo "$n + 10" | bc -l)"
next=docs/"$(printf "%05d" "$n2")".md
end
echo "$next"
nano -s 'aspell -c' "$next"
Bonus: It outputs the current filename to the console, so that if I want to add stuff after where I'm currently at, I have the starting number.
The entire scaffold for my books is three scripts, some standard CSS, JS and YAML. Which makes setting up a new one to match my sensibilities, quick and simple.