noc-book-2/README.md

41 lines
1.7 KiB
Markdown
Raw Normal View History

2022-07-22 17:21:32 +02:00
# The Nature of Code 2nd Edition
2022-07-20 21:19:04 +02:00
2022-10-11 21:44:49 +02:00
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.](docs/images/data-flow.png)
## Edit & Import
![Notion Database Screenshot](docs/images/notion-database.png)
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
2023-03-03 03:42:56 +01:00
Each entity also contains a page of its content, which will be transformed to `html` files based on the [schema](docs/import-schemes.md). The transformation script ([nature-of-code/fetch-notion](https://github.com/nature-of-code/fetch-notion)) is written in Node.js, utilized as a GitHub action.
2022-10-11 21:44:49 +02:00
## Build
2022-07-22 17:21:32 +02:00
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`.
2022-07-21 03:39:22 +02:00
```bash
# Install Dependencies
npm install
2022-10-11 21:44:49 +02:00
# Build PDF (Magicbook) in `build` directory
2022-07-21 03:39:22 +02:00
npm run build:pdf
2022-10-11 21:44:49 +02:00
# Build Website in `public` directory
2022-07-21 03:39:22 +02:00
npm run build
```
2023-08-13 01:15:45 +02:00
## Attributions
Icons used in this project:
2023-09-19 17:50:18 +02:00
🖍️ (Crayon) & 🦜 (Parrot) & 🔎 (Magnifying glass) from [OpenMoji](https://openmoji.org/) [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/#)