npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

starlight-codeblock-fullscreen

v0.1.4

Published

Add fullscreen functionality to codeblocks in your documentation website.

Readme

npm version License: MIT

Features

  • Fullscreen Mode: Toggle code blocks to fullscreen view for better readability,
  • Keyboard Navigation: Exit fullscreen with Escape key or browser back button,
  • Customizable Icons: Use custom SVG paths for fullscreen buttons,
  • Flexible Configuration: Control animations and button placement,
  • Responsive Design: Works seamlessly across different screen sizes,
  • Accessibility: Full keyboard navigation and focus management,
  • Smooth Animations: Configurable animation duration for transitions,
  • Smart Targeting: Choose to add buttons to all blocks or only titled ones.

Installation

Install the plugin using your preferred package manager:

# npm
npm install starlight-codeblock-fullscreen

# pnpm
pnpm add starlight-codeblock-fullscreen

# yarn
yarn add starlight-codeblock-fullscreen

Quick Start

Add the plugin to your Astro Starlight configuration:

// astro.config.mjs
import { defineConfig } from 'astro/config'
import starlight from '@astrojs/starlight'
import starlightCodeblockFullscreen from 'starlight-codeblock-fullscreen'

export default defineConfig({
  integrations: [
    starlight({
      plugins: [
        starlightCodeblockFullscreen({
          // Optional configuration
        }),
      ],
      title: 'My Documentation',
    }),
  ],
})

That's it! The plugin will automatically add fullscreen buttons to all your code blocks.

Example Configurations

Basic Configuration

starlightCodeblockFullscreen({
  fullscreenButtonTooltip: 'View in fullscreen',
  enableEscapeKey: true,
  exitOnBrowserBack: true,
})

Advanced Configuration

starlightCodeblockFullscreen({
  fullscreenButtonTooltip: 'Expand code block',
  enableEscapeKey: true,
  exitOnBrowserBack: true,
  addToUntitledBlocks: true,
  animationDuration: 300,
  svgPathFullscreenOn: "M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z",
  svgPathFullscreenOff: "M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z",
})

User Interactions

  • Click the toggle fullscreen button to enter/exit fullscreen mode
  • Press Escape to exit fullscreen (if enabled)
  • Use browser back button to exit fullscreen (if enabled)
  • Tab navigation works within fullscreen mode

Requirements

  • Astro Starlight: >=0.34
  • Node.js: ^18.17.1 || ^20.3.0 || >=21.0.0

Troubleshooting

Fullscreen button not appearing

  1. Ensure you're using Expressive Code blocks (the default in Starlight)
  2. Check if addToUntitledBlocks is set correctly for your use case
  3. Verify the plugin is properly added to your Starlight configuration

Keyboard shortcuts not working

  1. Verify enableEscapeKey and exitOnBrowserBack are set to true
  2. Check if other scripts are preventing event propagation
  3. Ensure the fullscreen container has proper focus

Documentation

For comprehensive documentation 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