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

@mistweaverco/mdsvex-shiki

v1.3.0

Published

Shiki syntax highlighter for mdsvex

Readme

mdsvex-shiki

A highlighter for mdsvex using Shiki with support for most common transformers out of the box.

Why? Because mdsvex's built-in Prism highlighter is limited in features and customization options.

We needed a better solution for our SvelteKit projects, so we created this package to fill the gap.

Installation

Using your package manager of choice, run:

# npm
npm install @mistweaverco/[email protected]

# yarn
yarn add @mistweaverco/[email protected]

# bun
bun add @mistweaverco/[email protected]

# pnpm
pnpm add @mistweaverco/[email protected]

# deno
deno add npm:@mistweaverco/[email protected]

Configuration

Available options are as follows:

  • displayPath: Whether to show the file path in the title bar when a path is provided. (default: false) (e.g., sh path=/path/to/file.sh). Paths are displayed with directory and file icons. Long paths are collapsed with a tooltip showing the full path.
  • displayLang: Whether to show the language label in the title bar. (default: false)
  • disableCopyButton: Whether to disable the copy button. (default: false)
  • shikiOptions: Options passed directly to Shiki's codeToHtml function.
    • theme: Shiki theme to use. (default: "tokyo-night")
    • transformers: Array of Shiki transformers to apply. By default, the following transformers are included:
      • transformerMetaHighlight()
      • transformerMetaWordHighlight()
      • transformerNotationDiff()
      • transformerNotationHighlight()
      • transformerNotationWordHighlight()
      • transformerNotationErrorLevel()
const options = {
  displayPath: true,
  displayLang: true,
  shikiOptions: {
    theme: 'nord',
  }
}

Import styles

If you just want to basic Shiki styling without the bar, you don't need to import this CSS file.

If you want to display the path, language and/or copy button, you must import the CSS file.

Probably in the root layout or HTML file that wraps your markdown content.

(e.g., src/routes/blog/+layout.svelte or src/app.html)

import '@mistweaverco/mdsvex-shiki/styles.css';

Now, you can use the bar features in your code blocks.

Enable Copy Button Functionality

To make the copy button work, you need to apply the copyAction Svelte action to a container element that wraps your markdown content.

In your layout file (e.g., src/routes/blog/+layout.svelte):

<script>
  import { copyAction } from '@mistweaverco/mdsvex-shiki/copyAction';
</script>

<div use:copyAction>
  <slot />
</div>

Or if you're rendering markdown content directly:

<script>
  import { copyAction } from '@mistweaverco/mdsvex-shiki';
</script>

<div use:copyAction>
  {@html content}
</div>

The copy button will automatically copy the code content to the clipboard when clicked and show a "Copied!" feedback message.

In svelte.config.js:

import mdsvexShiki from 'mdsvex-shiki'

const config = {
  // ...
  preprocess: [
    // ...
    mdsvex({
      // ...
      highlight: {
        highlighter: await mdsvexShiki({
          displayPath: true,
          displayLang: true,
          shikiOptions: {
            // Shiki options
            // every option supported by Shiki's `codeToHtml` function
            // with defaults for `theme` and `formatters`
            theme: 'nord',
            wrap: true,
          },
        })
      }
    }),
  ],
}