Hacker News new | ask | show | jobs
by lihaoyi 1658 days ago
For my book Hands on Scala, I did a totaly different approach: parsed markdown into HTML myself, used puppeteer to turn it into PDFs. I extended markdown with some macros to do the things I needed (e.g. named cross-references, two-column sections, graphviz diagram blocks, pulling in code snippets from the examples folder)

The build tool made it easy to import libraries like CommonMark-Java or ApachePDFBox to do what I wanted, wire in external tools like Puppeteer, and gave parallelism and incrementality for free. End result was <1s turnaround on editing chapters and <60s turnaround to regenerate the whole book from scratch, with the ability to spit out pdf/epub/web versions of the book in both 5-chapter-preview and 20-chapter-full versions. Since it's all HTML/CSS, and I'm a web developer, I could make it look any way I wanted.

The build pipeline is here, if anyone wants to take a look https://github.com/handsonscala/build. There's a link to the main website you can download samples to see how it ends up looking

1 comments

I see that you have a physical copy on sale on amazon KDP - How do you manage getting a pdf into KDP (I understand it is possible just that it is not recommended / renders poorly)?