Skip to content

Getting Started

Add fullscreen functionality to code blocks in your Starlight documentation website. This plugin enhances Expressive Code blocks by adding a fullscreen toggle button that allows users to view code in an immersive fullscreen mode.

You will need to have a Starlight website set up. If you don’t have one yet, you can follow the “Getting Started” guide in the Starlight docs to create one.

  1. starlight-codeblock-fullscreen is a Starlight plugin. Install it by running the following command in your terminal:

    Terminal window
    npm install starlight-codeblock-fullscreen
  2. Configure the plugin in your Starlight configuration in the astro.config.mjs file.

    astro.config.mjs
    import starlight from '@astrojs/starlight'
    import { defineConfig } from 'astro/config'
    import starlightCodeblockFullscreen from 'starlight-codeblock-fullscreen'
    export default defineConfig({
    integrations: [
    starlight({
    plugins: [starlightCodeblockFullscreen()],
    title: 'My Docs',
    }),
    ],
    })
  3. Start the development server to see the fullscreen toggle buttons added to your code blocks.