Skip to content

Tooling

Golam Kuadir Khan Prince edited this page Oct 25, 2026 · 1 revision

Tooling

Everything that turns the Markdown into a PDF, checks it, and serves it to AI clients.

Building the PDF

The PDF is built from the Markdown sources: markdown-it renders the text, KaTeX typesets the math on the server side, and a local headless Chrome, Edge or Chromium prints the result through puppeteer-core, with clickable contents and PDF bookmarks.

Requirements

  • Node.js ≥ 18
  • Google Chrome, Microsoft Edge or Chromium (set CHROME_PATH if it is not found automatically)

Build

npm install
npm run pdf

This writes dist/Electronics-and-Computing.pdf and reports any math expression that failed to render or any missing image. To build an excerpt (part openers are P1…P8, chapters 1…35):

node scripts/build-pdf.mjs --parts P3,11,12 --out dist/excerpt.pdf

Add --html to keep the intermediate HTML for debugging.

Releases

The Build PDF and release workflow (.github/workflows/release.yml) builds the PDF on GitHub's Ubuntu runners. Pushing a version tag publishes a release with the PDF attached and the matching section of CHANGELOG.md as notes:

git tag v1.0.1
git push origin v1.0.1

Running the workflow by hand (Actions → Build PDF and release → Run workflow) uploads the PDF as a build artifact instead.

Book checks and CI

The Check book workflow runs on every push and pull request: npm run check (TOC coverage, chapter layout, math delimiters, figure markers, links; the figure plan is up to date; the MCP smoke test) and every figure script.

MCP server

A Model Context Protocol server that lets an AI client browse, search, cite and typeset this book. It speaks MCP over stdio.

Setup

npm install

Claude Code — the repository ships a project .mcp.json, so opening the repo in Claude Code offers the server automatically. To add it by hand:

claude mcp add electronics-computing -- node /absolute/path/to/Electronics-and-Computing/mcp/server.mjs

Claude Desktop / other clients — add to the client's MCP config:

{
  "mcpServers": {
    "electronics-computing": { "command": "node", "args": ["/absolute/path/to/Electronics-and-Computing/mcp/server.mjs"] }
  }
}

Tools

Tool What it does
list_contents Part openers and chapters with ids, titles, files and section headings
read_part Markdown of a chapter (id: "14") or part opener (id: "P3"), optionally one section (section: "14.5" or a title word)
search_book Full-text or regex search with chapter, section and line number for every hit
list_figures Figures in a chapter (or the whole book) with captions
get_figure Returns a figure as an image, by path from list_figures
build_pdf Builds the whole book or selected parts to PDF and reports any math/image problems

Resources and prompts

  • Resource template book://part/{id} — the Markdown of each chapter or part opener.
  • Prompt explain_section(id, section) — walks through a section in the book's own method (engineering problem → model → analysis → status of the principle → measurable consequence).

build_pdf needs a local Chrome, Edge or Chromium (or CHROME_PATH); see scripts/build-pdf.mjs.

Example questions to ask

  • "Using the electronics-computing book, explain why the IRF540N in the opening of Chapter 4 overheats at 3.3 V gate drive."
  • "Search the book for every place it uses volt-second balance and summarise the method."
  • "Show me Figure 14.5 and explain why a two-flip-flop synchronizer's MTBF grows so fast with resolution time."
  • "Build a PDF of Part VI only."

Testing

node scripts/mcp-smoke.mjs starts the server and exercises every read-only tool; CI runs it on each push.

Clone this wiki locally