book: Support text-based nomnoml blocks

This change adds support for inline nomnoml diagrams so that they're
easier to update and we don't need to render images separately.

Support was added via an mdbook preprocessor written in python. The
processor, which you can find in
`scripts/preprocess-graphics-book.py`, rewrites code blocks that start
with "diagram=nomnoml". It currently uses a pretty naive hand-written
regex "parser" to find the blocks, but it could certainly be cleaned
up in the future.

As a proof of concept, I've replaced the processes/threads diagram
with raw source.

Change-Id: If3bf55494efacb8ec12162089cb24e72f8ddb90b
Reviewed-on: https://chromium-review.googlesource.com/c/graphics-book/+/3781184
Reviewed-by: Jim Shargo <jshargo@chromium.org>
7 files changed
tree: b561e58f44c4c3bd94a0e8a4f21f4753b84b7781
  1. js/
  2. scripts/
  3. src/
  4. .firebaserc
  5. .gitignore
  6. book.toml
  7. firebase.json
  8. PRESUBMIT.py
  9. README.md
README.md

The Chrome Graphics Book

About

This is the source code for a public book and living document capturing the high level architecture and low-level details of graphics in Chrome and ChromeOS.

This book is currently written with https://rust-lang.github.io/mdBook/

Special Features

This mdbook supports some homebrew markdown extensions. These are provided by scripts/preprocess-graphics-book.py.

Nomnoml diagrams

One can create in-line nomnoml diagrams by formatting a code block like so:

``` diagram=nomnoml
[foo] -> [bar]
```

How To: Run the book locally

First, install mdbook following the guide [0].

Then, to build and run the book locally, run the command mdbook serve. This will start a local server that you can connect to at localhost:3000.

[0] https://rust-lang.github.io/mdBook/guide/installation.html

Deployment

The book is currently deployed at firebase. The public URL is https://graphics-book.web.app.

With the appropriate permissions on the project, one can build and push the book like so:

$ mdbook build && firebase deploy