Skip to content

Getting Started

The Typewriter plugin enhances Expressive Code blocks on your website by adding terminal typing animations to code blocks. Commands appear character-by-character with a blinking cursor, while output appears instantly.

This guide will show you how to add it to your website.

  1. Install the expressive-code-typewriter dependency using your preferred package manager:

    Terminal window
    npm i expressive-code-typewriter
  2. Add the plugin to your site’s Expressive Code configuration:

    astro.config.mjs
    import { defineConfig } from 'astro/config';
    import astroExpressiveCode from 'astro-expressive-code';
    import { pluginTypewriter } from 'expressive-code-typewriter';
    export default defineConfig({
    integrations: [
    astroExpressiveCode({
    plugins: [pluginTypewriter()],
    }),
    ],
    });
  3. That’s it! Now add the typed meta option to any code block to enable the typing animation.

Add typed to your code block’s meta string to enable the typing effect:

```bash typed
$ npm install my-package
Installing dependencies...
Done!
```

Lines starting with $ (the default prompt) type character-by-character, while other lines appear instantly.

For more information on how to configure the plugin, see the Configuration page.

This plugin is open-source software licensed under the MIT license. If you run into any bugs, please report issues on GitHub.