From 3e3f2117f9648beba208127136e12237c1be7da2 Mon Sep 17 00:00:00 2001 From: Erin Shaben Date: Wed, 8 Apr 2026 22:14:45 -0400 Subject: [PATCH 1/2] update the changelog --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 944cfdf..4850159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 0.1.0a11 + +### New Features + +#### `ai_docs` — Configurable page actions style and anchor + +Three new configuration options are available under the `ai_docs` plugin: + +- **`ai_page_actions_anchor`**: A CSS class name that scopes where the per-page AI actions widget is injected. When set, the plugin looks for an element with that class inside the toggle container (matched by `data-variant`) rather than wrapping the H1. Useful when the template renders its own anchor slots. +- **`ai_page_actions_style`**: Controls the widget presentation. Accepts `"split"` (default, a primary button with a dropdown arrow) or `"dropdown"` (a single button that opens a full dropdown menu). +- **`ai_page_actions_dropdown_label`**: Sets the label text shown on the dropdown trigger button when `ai_page_actions_style` is `"dropdown"`. + +### Bug Fixes + +#### `ai_docs` — `{target=\_blank}` stripped from resolved markdown output + +Resolved markdown files no longer contain `{target=\_blank}` attribute syntax. This attribute is unnecessary in plain markdown output, and when the `.jsonl` bundle is serialised via `json.dumps` the JSON spec requires every backslash to be escaped — turning `\_blank` in the source into `\\_blank` in the file. Removing the attribute at resolution time eliminates the escaping issue entirely. + ## 0.1.0a10 ### Bug Fixes From f4668c694d39e219cb52fd1f92a8749cf9cfd9a0 Mon Sep 17 00:00:00 2001 From: Erin Shaben Date: Wed, 8 Apr 2026 22:50:10 -0400 Subject: [PATCH 2/2] add docs on plugin integrations --- docs/plugin-integration.md | 225 +++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 docs/plugin-integration.md diff --git a/docs/plugin-integration.md b/docs/plugin-integration.md new file mode 100644 index 0000000..be3b321 --- /dev/null +++ b/docs/plugin-integration.md @@ -0,0 +1,225 @@ +# Plugin Integration & Data Flow + +This page documents how the `page_toggle` and `ai_docs` plugins work independently and together, including the full data lifecycle, dependencies, and what a consuming MkDocs project must provide. + +--- + +## `page_toggle` plugin + +### What it does + +Combines multiple variant pages (e.g. `stable`, `latest`) into a single canonical page with an interactive toggle UI. Non-canonical variant pages are removed from the built site. + +### Input + +Frontmatter on each page in the group: + +```yaml +toggle: + group: quickstart # groups pages together — must match across all variants + variant: stable # unique identifier for this variant + label: Stable # button label (defaults to variant if omitted) + canonical: true # marks the page that hosts the toggle UI (one per group) +``` + +Optional frontmatter for badge and test integration (see [Template requirements](#template-requirements)): + +```yaml +page_badges: + tutorial_badge: Beginner + test_workflow: my-workflow + +page_tests: + path: tests/path/to/test_file.ts +``` + +### Data lifecycle + +| Hook | What happens | +| :--- | :--- | +| `on_page_content` | Runs for every page. For toggle pages, extracts the H1 and stores it separately, pre-renders the TOC, fixes tabbed element IDs for non-canonical variants, and stores all data in `self.toggle_groups`. Non-canonical pages return empty HTML. The canonical page calls `render_toggle_page` immediately and returns the toggle container HTML. | +| `on_post_build` | Warns if any variants were processed after the canonical page (which would mean the toggle rendered with incomplete data). Deletes non-canonical variant output files from the site. | + +### What `render_toggle_page` produces + +A self-contained `
` block containing: + +- **`.toggle-header`** — one `` per variant holding that variant's H1 +- **`.toggle-buttons`** — one `