const {readFileSync} = require("fs") const {basename} = require("path") let [template, ...chapters] = process.argv.slice(2) function esc(str) { return str.replace(/[<>&"]/g, ch => ch == "<" ? "<" : ch == ">" ? ">" : ch == "&" ? "&" : """) } let toc = "" const section = /