Pagination using Hydrogen Sulfide 🧫
- 2 minutes
- July 15, 2019
Have a long scroll that you need to paginate into a Superbook?
Meet h2s, an intelligent paginator that chops a long inaccesible scroll down into a symmetrical—Superbook compatible—paginated stack (codex). 😉
Hydrogen Sulfide or
See the Superbook format to learn more. Better still, try reading a book of your interest on a tablet.
How does it work?:
h2s uses Puppeteer by Google under the hood. Since Puppeteer is enormous
h2s may act up a little when you’re installing it for the first time. Worry not, there is help out there or feel free to raise an issue on Github with us for help.
Once your installation is successful, there is a very small surface of an api that you need to remember. And the commands go like this:
$ h2s [options] [command]
Options: -V, –version output the version number -v, –version output the version number -h, –help output usage information
- $ h2s objectify # Turn
sanitized.htmlinto an ‘array like’ JSON.
- $ h2s pagify # Paginate with gadda-gadda line-tracking!
- $ h2s bookify # Templatize markup with layout to form actual pages
With just these three commands you can convert any markdown-compatible markup into a Superbook compatible codex.
What do the commands do?:
./interimfolder that is sibling to the
manuscriptfolder at the root of your Bookiza project.
$ h2s objectifyto pull up the contents into a set of key: value pairs.
$ h2s pagifyto paginate the key: value pairs according to a responsive template at
$ h2s bookifyto apply layout on paginated content and produce book. And voila, your Superbook is ready!
$ bookiza serverto load your book in development mode at
That’s it. Your scroll is now available like book, all paginated, formatted alongwith line-tracking!