Yet another man to epub converter :)

Posted on April 21, 2019 with tags . See the previous or next posts.

The world's simplest shell script! But it does the job…

One early result from getting the Kobo Forma reader I wrote before about was “how can I read as much as possible offline?”; and soon enough, I was looking for a man page to ebook (epub) converter.

Initial search seemed successful, but actually, none of the things I found worked correctly, or at least were not working for me. More precisely, I wanted something to generate a “book” with consistent internal links, so that I can jump from one page to another correctly. See the README for what I tried and gave up on.

In Debian, there is of course the online manpages service, and there’s also The Linux man-pages project which do this very well. However, the UI and style for these seem to be designed for interactive browsing, whereas a simple output is better for offline browsing.

So, after a bit of playing around with man -T html, mandoc and man2html, I settled on the later to write my tiny wrapper script. It’s a v0.0.1 release, but nevertheless works, so here it is: https://github.com/iustin/man2ebook.

Could be made much better, and switching the backend might be interesting, but it doesn’t need to be more complex. Of course, customising the metadata via the command line would be useful, the auto-generated TOC contains extraneous items, etc. etc. :)

P.S.: In other open-source related topics, I haven’t made a new Corydalis release in ages, but I’m slowly getting there…