Skip to content

kimi#7

Open
maooc wants to merge 1 commit intomainfrom
feature/kimi-interactive-containers
Open

kimi#7
maooc wants to merge 1 commit intomainfrom
feature/kimi-interactive-containers

Conversation

@maooc
Copy link
Copy Markdown
Owner

@maooc maooc commented Mar 13, 2026

This PR adds comprehensive interactive container support to Mistune:

  1. New assets module:

    • assets.py: Vanilla JavaScript and CSS for interactive features
    • Includes tabs, collapsible containers, and code cluster functionality
  2. New directive plugin:

    • containers.py: Unified container parser for tabs, tips, warnings, etc.
    • Supports ::: tabs, ::: tip, ::: warning, ::: note, ::: danger, etc.
    • Integrated with BlockParser lifecycle hooks
  3. New plugin:

    • code_cluster.py: Automatically clusters adjacent code blocks with different languages into tabbed interfaces
  4. Core enhancements:

    • BlockParser: Added lifecycle hooks for container parsing
    • BlockState: Added container tracking (container_stack, container_depth)
  5. Renderer enhancements:

    • HTMLRenderer: Added interactive container renderers
    • Added data-tab-name, data-container-type, data-cluster-id attributes
    • Added enable_interactive flag for opt-in features
  6. CLI enhancements:

    • Added --enable-interactive flag

All interactive features are opt-in via enable_interactive parameter to maintain backward compatibility and avoid performance overhead.

This PR adds comprehensive interactive container support to Mistune:

1. New assets module:
   - assets.py: Vanilla JavaScript and CSS for interactive features
   - Includes tabs, collapsible containers, and code cluster functionality

2. New directive plugin:
   - containers.py: Unified container parser for tabs, tips, warnings, etc.
   - Supports ::: tabs, ::: tip, ::: warning, ::: note, ::: danger, etc.
   - Integrated with BlockParser lifecycle hooks

3. New plugin:
   - code_cluster.py: Automatically clusters adjacent code blocks with
     different languages into tabbed interfaces

4. Core enhancements:
   - BlockParser: Added lifecycle hooks for container parsing
   - BlockState: Added container tracking (container_stack, container_depth)

5. Renderer enhancements:
   - HTMLRenderer: Added interactive container renderers
   - Added data-tab-name, data-container-type, data-cluster-id attributes
   - Added enable_interactive flag for opt-in features

6. CLI enhancements:
   - Added --enable-interactive flag

All interactive features are opt-in via enable_interactive parameter
to maintain backward compatibility and avoid performance overhead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants