Find a file
Daniel Shiffman 15dce0a09c
Merge pull request #871 from nature-of-code/notion-update-docs
one change in chapter 4 + codesplit allowbreak test
2024-02-26 21:59:01 -05:00
.github Update FUNDING.yml 2023-09-10 19:12:04 -04:00
content Notion - Update docs 2024-02-27 02:57:24 +00:00
docs update doc 2023-08-29 23:19:20 +08:00
gatsby add Example endpoint 2024-01-24 14:28:44 +08:00
magicbook add class to allow break in codesplit pairs 2024-02-27 10:52:16 +08:00
src add /example page and links 2024-01-24 14:58:43 +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 Create .prettierrc 2022-04-04 16:40:23 -04:00
gatsby-browser.js add codesplit support 2022-08-17 22:02:53 -04:00
gatsby-config.js change section type name 2024-01-24 14:27:00 +08: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 updating magicbook 2024-02-26 12:25:34 -05:00
package.json updating magicbook 2024-02-26 12:25:34 -05:00
postcss.config.js add codesplit support 2022-08-17 22:02:53 -04:00
README.md add icon attribution 2023-09-19 23:50:18 +08:00
tailwind.config.js update layout styles / separate components 2022-08-25 15:57:04 -04:00

The Nature of Code 2nd Edition

This repo contains all the files for the Nature of Code 2nd edition. The book is now being authored in Notion and imported here as raw HTML files (which are then used to build the print PDF and gatsby website).

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

Edit & Import

Notion Database Screenshot

Content are stored in a Notion Database with the following attributes:

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

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

Build

Following are the steps to build the book and website, however, you will have to skip the import-notion-docs as that can only be done with 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) & 🔎 (Magnifying glass) from OpenMoji CC BY-SA 4.0