Find a file
2023-02-06 00:41:19 +00:00
.github/workflows Update notion-git.yml 2022-07-25 17:05:20 -04:00
content Notion - Update docs 2023-02-06 00:41:19 +00:00
docs update test and docs 2022-11-28 10:17:14 -05:00
gatsby support pdf-only and web-only blocks 2022-11-28 11:25:59 -05:00
magicbook support pdf-only and web-only blocks 2022-11-28 11:25:59 -05:00
scripts fix error of unknown callout block 2023-01-04 14:40:53 -05:00
src add left-float class and clearance for headings 2023-01-23 14:59:23 -05:00
.env.example update import script 2022-07-20 15:22:10 -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 embed examples in gatsby site 2022-08-08 15:56:08 -04:00
magicbook.json support magicbook (external/internal) links generation 2022-10-25 15:26:10 -04:00
package-lock.json Notion - Update docs 2022-11-28 16:31:26 +00:00
package.json support pdf-only and web-only blocks 2022-11-28 11:25:59 -05:00
postcss.config.js add codesplit support 2022-08-17 22:02:53 -04:00
README.md update docs 2022-10-11 15:44:49 -04: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 scheme written here.

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

# Import Notion Pages
npm run import-notion-docs

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

# Build Website in `public` directory
npm run build