Find a file
Daniel Shiffman 8a69676c8e
Merge pull request #1044 from nature-of-code/dev/custom-toc
Feat: add ability to customize toc for pages
2024-11-04 09:49:28 -05:00
.github bump actions version 2024-07-12 23:54:06 +08:00
content Notion - Update docs 2024-10-21 23:29:59 +00:00
docs update doc 2023-08-29 23:19:20 +08:00
gatsby feat: prevent creation of pages with duplicate names 2024-10-23 11:51:52 -03:00
magicbook ignore video-link in pdf build 2024-07-06 01:28:34 +08:00
src Merge branch 'main' into dev/custom-toc 2024-11-04 09:43:37 -05:00
static [feat] improve social media display 2024-08-26 00:36:12 +08:00
tests test update: screenshots dimensions exception list 2023-10-09 10:13:42 -04:00
.gitignore add prince license 2024-01-16 21:38:10 +08:00
.prettierrc add prettier-plugin-tailwindcss 2024-04-10 19:03:56 -04:00
errata.md Update errata.md 2024-10-21 19:12:09 -04:00
gatsby-browser.js modified color palette to achieve better contrast 2024-06-07 14:57:45 +08:00
gatsby-config.js feat: add the "Credits" page 2024-10-23 11:56:36 -03:00
gatsby-node.js fix copying files from examples 2023-02-26 11:04:37 -05:00
magicbook.json updating magicbook 2024-02-26 12:25:34 -05:00
package-lock.json feat: keep the dom elements in code snippet 2024-09-12 18:48:08 +08:00
package.json feat: keep the dom elements in code snippet 2024-09-12 18:48:08 +08:00
postcss.config.js add codesplit support 2022-08-17 22:02:53 -04:00
README.md update and change language 2024-11-04 08:26:31 -05:00
tailwind.config.js Merge pull request #941 from nature-of-code/dev/misc-update 2024-04-24 08:51:22 -04:00

The Nature of Code (2024 p5.js edition!)

This repository contains all the files for The Nature of Code book. The source content for the book is stored in a private Notion database and imported here as raw HTML files, which are then used to build the print PDF and Gatsby website.

If you are looking for the 2012 edition of The Nature of Code book, the website is archived here along with the GitHub source archive.

Errata

The Errata page tracks all uncorrected errors in the print edition since the publication date (September 3, 2024). If you would like to submit an error, please open an issue. All corrections must go through the Notion database, so unfortunately pull requests cannot be accepted.

Exercise Solutions

There are exercises throughout the book that are open-ended and have multiple creative solutions. If you would like to submit a solution for these exercises, please open an issue with the exercise number and a link to your p5.js sketch. For the sketch to be added to the website, it will be re-saved to the Nature of Code web editor account. Please leave your name and URLs in the code comments so you can be credited properly!

There is also a showcase on the Coding Train website, where you can submit creative interpretations of the book content and exercises.

Example Ports to Other Languages

The website includes a page with ports of the examples to other languages and environments.

If you would like to add a resource to this list, please open an issue with the links and information related to your port.

Book Build Process

Data flow chart showing three parts: edit, store, and output.

Edit & Import

Notion Database Screenshot

Content is stored in a Notion database with the following attributes:

  • Type (Page | Chapter): handled differently during builds, currently only used in the website build.
  • Title: defines the title
  • Status (Draft | Published): only Published content will be imported
  • File Name: defines the page sequence in a PDF build
  • Slug: defines the path in the web page URL

Each entity also contains a page of its content, which is transformed into html files based on the schema. The transformation script (nature-of-code/fetch-notion) is written in Node.js and utilized as a GitHub action.

Build

The following steps describe how to build the book and website. However, you will need to skip the import-notion-docs step, as it requires the Notion API key associated with the book. You can find the latest HTML version of the book in /content.

# Install Dependencies
npm install

# Build PDF (Magicbook) in `build` directory
npm run build:pdf

# Build Website in `public` directory
npm run build

Attributions

Icons used in this project:

🖍️ (Crayon), 🦜 (Parrot), and 🔎 (Magnifying glass) from OpenMoji CC BY-SA 4.0