docs: render documentation site with mdbook - #326
Conversation
## Summary Closes #122. Wires up [mdbook](https://rust-lang.github.io/mdBook/) so the existing `docs/` markdown can be rendered as a browsable site. ## Changes - `book.toml`: mdbook config pointing `src` at `docs/`, with `git-repository-url` and an `edit-url-template` so each page links back to its source on `main`. - `docs/SUMMARY.md`: required mdbook table of contents. Groups pages into two parts — **Consensus** (3SF-mini, LMD-GHOST) and **Operations** (Metrics, Checkpoint Sync, Fork Choice Visualization). - `docs/introduction.md`: landing page that orients the reader and links to the existing `docs/infographics/*.html` (mdbook copies the HTML files into the rendered site as-is). - `Makefile`: `docs-deps` (installs mdbook 0.4.51 via cargo), `docs` (one-shot build into `./book`), `docs-serve` (live-reload preview). - `.gitignore`: excludes the `book/` build output. No mdbook plugins are pulled in — none of the current docs use mermaid / katex / GFM alerts, so the bare renderer is enough. Plugins can be added later if/when content needs them, following the [ethrex setup](https://github.com/lambdaclass/ethrex/blob/728dc7ded560c665ab1ff2cf7f3eeb197b5bc40f/Makefile#L201) referenced in the issue. ## Test plan - [x] `make docs-deps` (already installed locally; verified target works) - [x] `make docs` builds successfully and produces a complete site - [x] `make docs-serve` renders Introduction + Consensus + Operations sections in the sidebar with correct ordering - [x] Both infographics under `docs/infographics/` are reachable from the introduction page - [ ] CI (no docs workflow added in this PR — left as a follow-up)
🤖 Kimi Code ReviewOverall: This is a documentation infrastructure PR adding mdbook support. No consensus-critical code is modified, but there are structural issues that will break the documentation build. Critical IssuesMissing source files (will break build)
Without these files, Security & Build IntegrityMakefile line 51: Add docs-deps:
cargo install --locked --version 0.4.51 mdbookbook.toml line 8: Verify SuggestionsMakefile line 54: Consider adding a check for the binary in docs:
@which mdbook > /dev/null || (echo "mdbook not found. Run 'make docs-deps' first." && exit 1)
mdbook buildbook.toml line 6: The description contains "implementation" which is spelled correctly, but verify the title "ethlambda" matches the project's preferred capitalization elsewhere. VerdictThe infrastructure setup is correct for mdbook, but do not merge until the missing markdown files and infographic assets are added or the SUMMARY/introduction is adjusted to reference only existing files. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Claude Code ReviewHere is the review for PR #326: PR #326 — docs: render documentation site with mdbookOverview: Pure documentation infra PR — wires up mdbook to render the existing Potential Bug — broken "Edit this page" links
edit-url-template = "https://github.com/lambdaclass/ethlambda/edit/main/{path}"In mdbook, The correct template should include the edit-url-template = "https://github.com/lambdaclass/ethlambda/edit/main/docs/{path}"Without this fix, every "Edit this page" button in the rendered site will 404. Minor Points
What Looks Good
Bottom line: One real bug (the broken edit-URL template), one mild DX rough edge (missing docs-deps dependency), and otherwise a clean, straightforward PR. Fix the template path before merging. Automated review by Claude (Anthropic) · sonnet · custom prompt |
Greptile SummaryThis PR wires up mdbook to render the existing Confidence Score: 4/5Safe to merge — documentation-only change with one minor reproducibility suggestion on the cargo install invocation. All changed files are documentation infrastructure with no application logic. The single finding is a P2 style suggestion (missing No files require special attention.
|
| Filename | Overview |
|---|---|
| .gitignore | Adds book/ exclusion for mdbook build output — straightforward and correct. |
| Makefile | Adds docs-deps, docs, and docs-serve targets; cargo install is missing --locked for full reproducibility. |
| book.toml | New mdbook config with correct src = "docs", repo URL, and edit-url-template; {path} expands to include the docs/ prefix in mdbook ≥0.4.8 so edit links resolve correctly. |
| docs/SUMMARY.md | Required mdbook TOC; all referenced files confirmed present in the repo. |
| docs/introduction.md | Clean landing page; infographic HTML paths and external links all resolve correctly. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[make docs-deps\ncargo install mdbook 0.4.51] --> B[make docs\nmdbook build]
B --> C[book/ output directory]
C --> D[book/index.html\nIntroduction]
C --> E[book/3sf_mini.html\nConsensus: 3SF-mini]
C --> F[book/lmd_ghost.html\nConsensus: LMD-GHOST]
C --> G[book/metrics.html\nOperations: Metrics]
C --> H[book/checkpoint_sync.html\nOperations: Checkpoint Sync]
C --> I[book/fork_choice_visualization.html\nOperations: Fork Choice Viz]
C --> J[book/infographics/\n*.html copied verbatim]
A2[make docs-serve\nmdbook serve --open] --> K[Live-reload preview\nlocalhost:3000]
style C fill:#f0f4ff,stroke:#4a6fa5
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Makefile
Line: 51
Comment:
**Consider adding `--locked` to the `cargo install` invocation**
Without `--locked`, Cargo resolves mdbook's transitive dependencies fresh on every install, which can produce a slightly different binary across developer machines even when the top-level version is pinned. Adding `--locked` forces Cargo to use the dependency versions recorded in mdbook's upstream `Cargo.lock`, making the installed tool fully reproducible.
```suggestion
cargo install --locked --version 0.4.51 mdbook
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "docs: render documentation site with mdb..." | Re-trigger Greptile
| @echo "Starting local devnet. Press Ctrl+C to stop all nodes." | ||
| @cd lean-quickstart \ | ||
| && NETWORK_DIR=local-devnet ./spin-node.sh --node all --generateGenesis --metrics > ../devnet.log 2>&1 | ||
|
|
There was a problem hiding this comment.
Consider adding
--locked to the cargo install invocation
Without --locked, Cargo resolves mdbook's transitive dependencies fresh on every install, which can produce a slightly different binary across developer machines even when the top-level version is pinned. Adding --locked forces Cargo to use the dependency versions recorded in mdbook's upstream Cargo.lock, making the installed tool fully reproducible.
| cargo install --locked --version 0.4.51 mdbook |
Prompt To Fix With AI
This is a comment left during a code review.
Path: Makefile
Line: 51
Comment:
**Consider adding `--locked` to the `cargo install` invocation**
Without `--locked`, Cargo resolves mdbook's transitive dependencies fresh on every install, which can produce a slightly different binary across developer machines even when the top-level version is pinned. Adding `--locked` forces Cargo to use the dependency versions recorded in mdbook's upstream `Cargo.lock`, making the installed tool fully reproducible.
```suggestion
cargo install --locked --version 0.4.51 mdbook
```
How can I resolve this? If you propose a fix, please make it concise.
🤖 Codex Code ReviewNo correctness, security, or performance findings in the changed lines. This PR is docs/build-only: it adds mdBook scaffolding and navigation, but it does not touch fork choice, attestation validation, justification/finalization, state transition, XMSS, or SSZ code paths. I also checked that the new links in Residual risk: I couldn’t run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
- Pin mdbook to v0.5.2 (latest stable) instead of v0.4.51. - Add the [`mdbook-linkcheck2`](https://github.com/marxin/mdbook-linkcheck2) backend so broken intra-doc links fail the build instead of shipping silently. Configured `optional = true` so the build still succeeds for contributors who only install `mdbook` itself. - Fix two pre-existing broken links in `docs/3sf_mini.md` that linkcheck2 caught on the first run: references to a non-existent `ghost-fork-choice.md` were retargeted to the actual `lmd_ghost.md`.
Summary
Closes #122. Wires up mdbook so the existing
docs/markdown can be rendered as a browsable site.Changes
book.toml: mdbook config pointingsrcatdocs/, withgit-repository-urland anedit-url-templateso each page links back to its source onmain.docs/SUMMARY.md: required mdbook table of contents. Groups pages into two parts — Consensus (3SF-mini, LMD-GHOST) and Operations (Metrics, Checkpoint Sync, Fork Choice Visualization).docs/introduction.md: landing page that orients the reader and links to the existingdocs/infographics/*.html(mdbook copies the HTML files into the rendered site as-is).Makefile:docs-deps(installs mdbook 0.4.51 via cargo),docs(one-shot build into./book),docs-serve(live-reload preview)..gitignore: excludes thebook/build output.No mdbook plugins are pulled in — none of the current docs use mermaid / katex / GFM alerts, so the bare renderer is enough. Plugins can be added later if/when content needs them, following the ethrex setup referenced in the issue.
Test plan
make docs-depsinstalls mdbook (already cached locally; target verified)make docsbuilds successfully and produces a completebook/sitemake docs-serverenders Introduction + Consensus + Operations sections in the sidebar with correct orderingdocs/infographics/are reachable from the introduction page