Conversation
- Add ability to anchor the per page widget to any class - Add ability to specify between two different styles of dropdown menus
…the unified plugin
…swapping html div placeholders for comments
There was a problem hiding this comment.
Pull request overview
This PR extends the ai_docs plugin’s per-page AI actions widget to support configurable layout (“split” vs “dropdown”), a configurable injection anchor (by CSS class), and more precise CSS targeting via modifier classes, with accompanying refactors, docs updates, and tests.
Changes:
- Added
ai_page_actions_anchor,ai_page_actions_style, andai_page_actions_dropdown_labeloptions toai_docs, including new anchor-based injection behavior. - Refactored
AIFileUtils.generate_dropdown_html()to support both “split” and “dropdown” widget styles plus optional extra container classes. - Updated documentation and tests; removed the legacy MCP section generation from the deprecated
ai_resources_pageplugin/tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
plugins/ai_docs/plugin.py |
Adds new config options, refactors widget HTML creation, and introduces anchor-class injection plus table widget class modifiers. |
helper_lib/ai_file_utils/ai_file_utils.py |
Implements style, dropdown_label, and extra_classes for widget HTML generation. |
docs/ai-docs.md |
Documents new ai_docs configuration options and behavior. |
docs/ai-page-actions.md |
Adds CSS class/modifier documentation and styling examples. |
plugins/ai_resources_page/plugin.py |
Removes the legacy MCP section generation from the deprecated plugin. |
tests/ai_docs/test_ai_docs.py |
Updates placeholder expectations and adds coverage for anchor + style options. |
tests/ai_file_utils/test_ai_file_utils.py |
Adds coverage for new generate_dropdown_html() style/label/class behavior. |
tests/ai_resources_page/test_ai_resources_page.py |
Removes MCP section tests aligned with deprecated plugin behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… errors with selectors
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
To test out the dropdown view and use of a custom anchor, spin this up with these branches: polkadot-mkdocs: eshaben/header-page-info Should also be tested using other configs, for example:
But remember as you test things out, it might not look perfect, that's because the CSS would need to be adapted for different scenarios. The above branches are catered to look good with the custom anchor. The old default (split view, no custom anchor) don't look good on the above Polkadot branches, but could be tested with Moonbeam/kluster or using Polkadot |
0xlukem
left a comment
There was a problem hiding this comment.
Great work ❤️ I tested all the versions and edge cases I could think of, and it works. I left just two suggestions at the UI level that we can address, and that's it
✨ This PR paves the way for us to change the styling of the dropdowns in Polkadot, while keeping the old styling in tact for other projects. ✨
This pull request adds new customization options for the AI actions widget in the documentation site, allowing users to choose between "split" and "dropdown" widget styles and to specify a custom anchor location for widget placement. It also improves the flexibility of CSS targeting for these widgets and updates the documentation accordingly. Additionally, the code has been refactored to support these new options and to clean up related logic.
AI Actions Widget Customization:
ai_page_actions_styleoption ("split"or"dropdown") and a customizableai_page_actions_dropdown_labelin both the plugin configuration (plugins/ai_docs/plugin.py) and the widget HTML generation (ai_file_utils.py). This allows users to choose between a split-button style (copy button + dropdown) and a single dropdown button with a custom label. [1] [2] [3] [4]ai_page_actions_anchoroption, letting users specify a CSS class where the widget should be injected instead of the default H1 wrapper. The plugin now supports injecting the widget into all matching elements, with fallback and debug logging if none are found. [1] [2] [3] [4]Codebase Refactoring and Consistency:
ai_file_utils.pyto support both widget styles, extra CSS classes, and improved code structure. [1] [2] [3]ai-file-actions-container--table) for widgets in tables, improving CSS targeting and maintainability. [1] [2]Other Cleanups:
_generate_mcp_sectionmethod and related code from the AI resources page plugin, as it is no longer needed. [1] [2]