authoring-tools-research

mdbook - Book authoring tool used by the Rust programming language project

Specifically for authoring content with chapters.

Easy to use, lightweight, straightforward local authoring and publishing stories.

Local authoring story

One-time: Download and install a single prebuilt executable for your architecture, and put it in your PATH.

The Table-of-Contents format is somewhat rigid.

Although mdbook doesn’t support linking to sections in a chapter file from the summary, forcing each section into a separate file, there are workarounds involving redirects that accomplish the desired effect (see the object.md source, which redirects to a section in the parent destructuring chapter). This makes re-organizing a chapter unnecessarily onerous. In addition, it forces each section into a separate (and potentially artificially small) page.

$ mdbook serve  # builds, watches for changes, refreshes local browser on change.

A book.toml defines a handful of other metadata. Chapter layout (i.e. table of contents) is defined in SUMMARY.md.

Publishing story

Basically, publish can be just Github Pages; GH Pages understands mdbook’s output, since it’s just static HTML/CSS.

  1. Configure book.toml to output the build to docs directory.
  2. Point your repo’s Github Pages settings to docs.
  3. git add/commit/push the mdbook build output (that is, docs) to Github.
  4. Github Pages renders it with a default Github Action.
  5. View it at https://.github.io/

MDBook examples