Add rehype-inject-figure plugin#582
Open
DavertMik wants to merge 2 commits into
Open
Conversation
New rehype plugin (src/lib/rehype-inject-figure.mjs) that inserts captioned figures into docs pages at a specified heading without editing the markdown. Each figure is configured in a single declarative array in astro.config.mjs (slug, afterHeading, before, replace, src, alt, width/height, caption). Includes a Vite dev-server hook to full-reload on /public/*.svg changes so diagrams hot-update. First injection: the running-tests-options diagram on the Running Tests Manually page. Adds hast-util-from-html dependency, supporting styles in custom.css, and a Cloudflare status CI workflow. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4 tasks
Deploying docs with
|
| Latest commit: |
66575cd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://165843f1.docs-c7r.pages.dev |
| Branch Preview URL: | https://rehype-inject-figure.docs-c7r.pages.dev |
⏱️ Cloudflare Build Status UnknownCould not determine Cloudflare deployment status within 15 minutes. Please check the Cloudflare Dashboard manually. |
Drop the example figureInjections entry and the corresponding SVG asset; the plugin ships with an empty injections array by default.
⏱️ Cloudflare Build Status UnknownCould not determine Cloudflare deployment status within 15 minutes. Please check the Cloudflare Dashboard manually. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/lib/rehype-inject-figure.mjsplugin that injects captioned<figure>elements into docs pages at a specified heading — driven by a declarative array inastro.config.mjs, no markdown edits required.before/afterplacement relative to the heading and an optionalreplacemode to swap a specific element (e.g. a table) with the figure.running-tests-options.svgdiagram on the Running Tests Manually page.hast-util-from-htmldependency and supporting styles incustom.cssto handle the injected figure's wrapper and zoomable child.Test plan
npm installsucceeds with the newhast-util-from-htmldependency.npm run dev— confirm the figure renders above How to Launch from the Tests Page on/project/runs/running-tests-manually.public/running-tests-options.svgtriggers a full reload in dev.npm run buildcompletes; no link-validator regressions.🤖 Generated with Claude Code