“The Nature of Code” is a book about computer simulation of natural systems authored by Daniel Shiffman, a professor at the Interactive Telecommunications Program (ITP) at NYU. The original version was published in 2012 with both print and digital editions. Recently, Dan has been working on a second edition of the book, and I was hired to develop the new website and update the building system (Node.js) for generating both the PDF and the website. It is expected to release by the end of 2022.
The previous content was written in HTML files with manually added class names and data attributes that can be picked up by the building tool for customized blocks. In this update, we added Notion as a CMS (Content Management System) and used Notion API to fetch the content and generate back the HTML files. In this way, we can have a much better editing experience while still maintaining the flexibility of having all content on hand in case we need to migrate to another service someday. Although some compromise was made to fit the original content inside, I am glad that Notion supports most of our needs (code snippet, nested block, multi column).
As for the output part, the website was built with Gatsby.js. And the previous builder (Magicbook) remained for generating the PDF since it has great support for publications like pagination and table of contents. The whole system finally became the following:
- Content and the building system are open-sourced on GitHub