astro-dev-broken-anchor-healer — Brandon Hubbard Engineering
TYPESCRIPT · ASTRO DEV TOOLBAR

astro-dev-broken-anchor-healer — Automated Internal Anchor Link Validator & Healer

astro-dev-broken-anchor-healer is an Astro development integration that detects broken #hash anchor links when headings are edited or renamed. It combines Levenshtein fuzzy matching with local browser AI to suggest the closest valid target ID and patch your Markdown or Astro templates.

$ npm install -D astro-dev-broken-anchor-healer
GitHub ↗
01. Architectural Specifications STATUS: PRODUCTION READY
[ 01 // CAPABILITY ]

Anchor Link Scanner

Finds all internal href links and verifies them against active DOM id attributes.

[ 02 // CAPABILITY ]

Semantic Fuzzy Matching

Combines Levenshtein edit distance with Gemini Nano to match renamed heading IDs.

[ 03 // CAPABILITY ]

1-Click DOM Fixer

Highlights the broken anchor in viewport and updates the DOM attribute to verify link target instantly.

02. Implementation & Usage BUN / ASTRO 5+
// Installation CLI
bun add astro-dev-broken-anchor-healer
# or
pnpm add astro-dev-broken-anchor-healer
// Configuration astro.config.mjs
// astro.config.mjs
import { defineConfig } from "astro/config";
import devBrokenAnchorHealer from "astro-dev-broken-anchor-healer";

export default defineConfig({
  integrations: [
    devBrokenAnchorHealer({
      autoScanOnRoute: true
    })
  ]
});

// Chrome Built-in AI Prerequisites

  • 1. Open chrome://flags in Google Chrome 128+
  • 2. Set #prompt-api-for-gemini-nano to Enabled
  • 3. Set #optimization-guide-on-device-model to Enabled ByPassPerfRequirement
  • 4. Restart Chrome and verify model status at chrome://components