Skip to content

Extract anchor functionality into standalone mdbook-anchorez preprocessor#24

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/extract-anchor-functionality
Draft

Extract anchor functionality into standalone mdbook-anchorez preprocessor#24
Copilot wants to merge 2 commits intomainfrom
copilot/extract-anchor-functionality

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 7, 2026

mdbook-judgment handled both judgment rendering and {anchor} code-snippet embedding — the anchor piece is useful enough to publish independently. This splits it out into its own crate, mdbook-anchorez.

New mdbook-anchorez crate

  • Scans source files for // ANCHOR: name / // ANCHOR_END: name markers
  • Replaces {anchor}`name` references in markdown with rendered <figure> HTML blocks
  • Configurable via [preprocessor.anchorez] in book.toml:
    • src-dir — directory to scan (default: "src")
    • github-base — base URL for [src] links (default: "", omits the link)
[preprocessor.anchorez]
command = "cargo run -p mdbook-anchorez --"
github-base = "https://github.com/dada-lang/dada-model/blob/main"

mdbook-judgment cleanup

  • Removed Anchor struct, parse_anchors, dedent, render_anchor, anchor scanning, and the {anchor} replacement pass
  • SourceIndex now only holds judgments

Workspace / config

  • Added mdbook-anchorez to workspace members in root Cargo.toml
  • Added [preprocessor.anchorez] to book.toml

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: nikomatsakis <155238+nikomatsakis@users.noreply.github.com>
Copilot AI changed the title [WIP] Extract anchor functionality into separate mdbook plugin Extract anchor functionality into standalone mdbook-anchorez preprocessor Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants