Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a new MkDocs plugin (instant_preview_compat) that post-processes generated HTML to make Material for MkDocs instant previews start from meaningful article content (and optionally rewrites internal links to point at synthetic preview anchors), with accompanying docs and tests.
Changes:
- Added
InstantPreviewCompatPluginplus shared helper library to inject preview-root targets and rewrite preview-sensitive links. - Registered the plugin as a MkDocs entry point and bumped package version to
0.1.0a12. - Added documentation and a dedicated test suite covering core preview/anchor behaviors and plugin interactions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
plugins/instant_preview_compat/plugin.py |
Implements MkDocs plugin hooks for per-page processing and post-build link rewriting. |
helper_lib/instant_preview_compat.py |
Core HTML parsing/mutation and link-rewrite logic used by the plugin. |
tests/instant_preview_compat/test_instant_preview_compat.py |
Tests for anchor rewriting, exclusion/hoisting behavior, and toggle/AI-actions interactions. |
docs/instant-preview-compat.md |
Usage/config docs for the new plugin. |
README.md |
Adds the plugin to the documented plugin list and example configuration. |
pyproject.toml |
Registers MkDocs entry point and bumps version. |
plugins/instant_preview_compat/__init__.py |
Marks the plugin directory as a package. |
tests/instant_preview_compat/__init__.py |
Marks the test directory as a package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new MkDocs plugin,
instant_preview_compat, which improves the user experience of instant previews in Material for MkDocs by ensuring previews start at meaningful article content, even when extra UI elements are present near the page title. The plugin is fully documented, added to the project configuration, and accompanied by comprehensive tests.Key changes:
Plugin Implementation
InstantPreviewCompatPlugininplugins/instant_preview_compat/plugin.py, which post-processes built HTML to adjust instant preview anchors and content flow, supporting configuration for excluded selectors and internal link rewriting.pyproject.tomland incremented the package version to0.1.0a12. [1] [2]__init__.pyfiles for the new plugin and its tests to ensure package/module importability. [1] [2]Documentation
docs/instant-preview-compat.mdwith detailed usage instructions, configuration options, and notes on plugin behavior.README.mdto document the new plugin in the list of included plugins and in the example configuration. [1] [2]Testing
tests/instant_preview_compat/test_instant_preview_compat.pywith comprehensive tests covering core plugin functionality, including anchor rewriting, exclusion of UI elements, and interaction with other plugins.References:
[1] [2] [3] [4] [5] [6] [7] [8]