While working on #pdf4anki integrated the feature of automatically adding opinionated #CSS with #cheerio to the initial #HTML file. This had the unknown side effect of destroying all the self-closing HTML tags, thus breaking the pattern matching.
The fun of taking apart the code to #debug this issue.
While debugging the issue, added the feature of skipping files that have no matches and thereby reducing the disk storage. In the example patterns array there are 20 items and in the last execution of the script only 17 of them were required.
Further learnt the strength of using a callback function for #javascript `String.prototype.replace()` function.
Might integrate it further towards the existing pattern's ruling and thereby reduce the current piecewise nature.