Find a file
Daniel Shiffman bddd01117a
Merge pull request #358 from nature-of-code/notion-update-docs
misc edits and chapter 10 work
2023-07-25 08:26:51 -04:00
.github Create FUNDING.yml 2023-06-01 18:50:17 -04:00
content Notion - Update docs 2023-07-25 12:23:29 +00:00
docs update test and docs 2022-11-28 10:17:14 -05:00
gatsby add examples page 2023-04-18 13:57:05 -04:00
magicbook fix wrong direction 2023-04-17 16:52:42 -04:00
src add examples page 2023-04-18 13:57:05 -04:00
.gitignore add test 2022-09-30 15:33:25 -04: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 add local images handling in gatsby 2022-07-28 21:29:28 -04:00
gatsby-node.js fix copying files from examples 2023-02-26 11:04:37 -05:00
magicbook.json bump magicbook@0.1.31 and set output image to grey16 2023-04-23 22:17:23 -04:00
package-lock.json update katex 2023-07-12 09:25:32 -04:00
package.json update katex 2023-07-12 09:25:32 -04:00
postcss.config.js add codesplit support 2022-08-17 22:02:53 -04:00
README.md Update README.md 2023-03-02 21:42:56 -05: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