Skip to content

Add initial implementation of the mkdocs-color-swatch-plugin #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 20, 2025

Conversation

fabieu
Copy link
Owner

@fabieu fabieu commented Apr 20, 2025

This pull request introduces a new MkDocs plugin, mkdocs-color-swatch-plugin, which allows users to add inline color swatches to their Markdown documentation. The changes include the implementation of the plugin, its supporting assets, workflows for testing and publishing, and updates to documentation and configuration files.

Plugin Implementation:

  • mkdocs_color_swatch_plugin/plugin.py: Implements the ColorSwatchPlugin class, which integrates the plugin into MkDocs. It handles the injection of CSS and JavaScript assets and registers the ColorSwatchExtension for Markdown processing.
  • mkdocs_color_swatch_plugin/color_swatch.py: Defines the ColorSwatchExtension and ColorSwatchInlineProcessor to parse and render custom Markdown syntax for color swatches.

Supporting Assets:

  • CSS (mkdocs_color_swatch_plugin/assets/color-swatch.css): Provides styles for the color swatches, including hover animations and tooltips.
  • JavaScript (mkdocs_color_swatch_plugin/assets/color-swatch.js): Adds interactivity for copying color codes to the clipboard and displaying toast notifications.

Workflow and Configuration:

  • Workflows (.github/workflows):
    • build.yml: Automates the build, test, and publish process for the plugin.
    • test.yml: Runs tests using pytest on pull requests and manual triggers.
  • Configuration Files:
    • pyproject.toml: Defines the project metadata, dependencies, and entry points for the plugin.
    • mkdocs.yml: Configures the demo site for the plugin.

Documentation:

  • README.md: Provides an overview of the plugin, including features, installation instructions, syntax usage, and contribution guidelines.
  • Demo (docs/index.md): Demonstrates the plugin's functionality with sample color swatches.

fabieu added 6 commits April 19, 2025 20:25
Moved CSS and JS into standalone files for better modularity and maintainability, replacing embedded styles/scripts. Enhanced Markdown inline processor to support improved syntax for color swatches. Updated tests to validate new cases and handle invalid inputs.
This commit introduces workflows for automated releases, dependency updates, and package publishing. It includes a Dependabot configuration for managing Python and GitHub Actions updates, a release notes generator setup, and a build workflow to publish the package to PyPI and create GitHub releases.
@fabieu fabieu added the enhancement New feature or request label Apr 20, 2025
@fabieu fabieu self-assigned this Apr 20, 2025
@fabieu fabieu merged commit ea56370 into main Apr 20, 2025
1 check passed
@fabieu fabieu deleted the first-implemenation branch April 20, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant