mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-04-26 09:56:01 +02:00
d17d5159e8
- Migrate all docs.anthropic.com/en/docs/claude-code URLs to code.claude.com/docs/en - Document /usage as canonical (v2.1.118); annotate /cost and /stats as shortcut aliases - Update Opus 4.7: 1M context (v2.1.117 fix), xhigh default effort - Note native-binary packaging (v2.1.113) and downloads.claude.ai host (v2.1.116) - Hook events count normalized to 28 across all refs; add UserPromptExpansion, PostToolBatch - Add mcp_tool as a fifth hook type (v2.1.118); duration_ms on PostToolUse (v2.1.119) - Agent frontmatter mcpServers/permissionMode/--print tools honoring - Glob/Grep -> bfs/ugrep footnote for native macOS/Linux builds - Plugin marketplace enforcement (v2.1.117) + hostPattern/pathPattern (v2.1.119) - --from-pr supports GitLab MR, Bitbucket PR, GitHub Enterprise (v2.1.119) - Document 5 new env vars: DISABLE_UPDATES, CLAUDE_CODE_HIDE_CWD, CLAUDE_CODE_FORK_SUBAGENT, ENABLE_TOOL_SEARCH, OTEL_LOG_TOOL_DETAILS - Deprecate includeCoAuthoredBy and voiceEnabled; add prUrlTemplate setting - Add new features: /theme, /btw, claude plugin tag, claude install [version], sandbox.network.deniedDomains, auto mode "\$defaults", wslInheritsWindowsSettings, Vim visual modes, /doctor improvements, forked subagents, disableSkillShellExecution - Refresh footers to Last Updated April 24, 2026 / Claude Code Version 2.1.119
EPUB Builder Script
Build an EPUB ebook from the Claude How-To markdown files.
Features
- Organizes chapters by folder structure (01-slash-commands, 02-memory, etc.)
- Renders Mermaid diagrams as PNG images via Kroki.io API
- Async concurrent fetching - renders all diagrams in parallel
- Generates a cover image from the project logo
- Converts internal markdown links to EPUB chapter references
- Strict error mode - fails if any diagram cannot be rendered
Requirements
- Python 3.10+
- uv
- Internet connection for Mermaid diagram rendering
Quick Start
# Simplest way - uv handles everything
uv run scripts/build_epub.py
Development Setup
# Create virtual environment
uv venv
# Activate and install dependencies
source .venv/bin/activate
uv pip install -r requirements-dev.txt
# Run tests
pytest scripts/tests/ -v
# Run the script
python scripts/build_epub.py
Command-Line Options
usage: build_epub.py [-h] [--root ROOT] [--output OUTPUT] [--verbose]
[--timeout TIMEOUT] [--max-concurrent MAX_CONCURRENT]
options:
-h, --help show this help message and exit
--root, -r ROOT Root directory (default: repo root)
--output, -o OUTPUT Output path (default: claude-howto-guide.epub)
--verbose, -v Enable verbose logging
--timeout TIMEOUT API timeout in seconds (default: 30)
--max-concurrent N Max concurrent requests (default: 10)
Examples
# Build with verbose output
uv run scripts/build_epub.py --verbose
# Custom output location
uv run scripts/build_epub.py --output ~/Desktop/claude-guide.epub
# Limit concurrent requests (if rate-limited)
uv run scripts/build_epub.py --max-concurrent 5
Output
Creates claude-howto-guide.epub in the repository root directory.
The EPUB includes:
- Cover image with project logo
- Table of contents with nested sections
- All markdown content converted to EPUB-compatible HTML
- Mermaid diagrams rendered as PNG images
Running Tests
# With virtual environment
source .venv/bin/activate
pytest scripts/tests/ -v
# Or with uv directly
uv run --with pytest --with pytest-asyncio \
--with ebooklib --with markdown --with beautifulsoup4 \
--with httpx --with pillow --with tenacity \
pytest scripts/tests/ -v
Dependencies
Managed via PEP 723 inline script metadata:
| Package | Purpose |
|---|---|
ebooklib |
EPUB generation |
markdown |
Markdown to HTML conversion |
beautifulsoup4 |
HTML parsing |
httpx |
Async HTTP client |
pillow |
Cover image generation |
tenacity |
Retry logic |
Troubleshooting
Build fails with network error: Check internet connectivity and Kroki.io status. Try --timeout 60.
Rate limiting: Reduce concurrent requests with --max-concurrent 3.
Missing logo: The script generates a text-only cover if claude-howto-logo.png is not found.