Skip to content

frostybee/expressive-code-collapsible

Repository files navigation

Expressive Code Collapsible

A plugin for Expressive Code that adds collapsible functionality to code blocks, automatically collapsing long code with expand/collapse controls.

npm version License: MIT

Features

  • Long code blocks automatically collapse based on a configurable line threshold
  • Force collapse or expand on any block using collapse or nocollapse meta strings
  • Toggle buttons appear both as an overlay and in the header (when a title is present)
  • Animated transitions that respect prefers-reduced-motion
  • Accessible with ARIA attributes and customizable screen reader announcements
  • Works with Starlight, Astro, Next.js, and standalone Expressive Code setups

Installation

Install the plugin using your preferred package manager:

npm install expressive-code-collapsible

Quick Start

import { pluginCollapsible } from 'expressive-code-collapsible';

// Add to your Expressive Code configuration
plugins: [pluginCollapsible()]

Documentation

For comprehensive documentation, installation guides, configuration options, and examples, visit the plugin documentation.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

Licensed under the MIT License, Copyright © frostybee.

See LICENSE for more information.

Links

About

An Expressive Code plugin that adds expand and collapse functionality to code blocks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •