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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hexo-shiki-highlight

v3.3.0

Published

Dark & Light Theme

Downloads

1,208

Readme

Preview

Dark & Light Theme

| light | dark | | --------------------------------- | ------------------------------- |

Transformers Preview

transformer

For a live preview, see my blog.

Install

bun i hexo-shiki-highlight

Add the following to your Hexo _config.yml:

syntax_highlighter: shiki

If you want to customize the highlighter, add a shiki section to _config.yml:

shiki:
  code_collapse:
    enable: true # Enable code collapse feature. Default: true
    max_lines: 20 # Max lines before collapsing. Default: 20
    show_lines: 10 # Lines to show when collapsed. Default: 10

  exclude_languages: ["mermaid"] # Languages excluded from Shiki highlighting
  enable_transformers: true

toolbar_items

You can configure which items to show in the code block toolbar:

shiki:
  toolbar_items:
    lang: true
    title: true
    wrapToggle: true
    copyButton: true
    shrinkButton: true # toggle code collapse/expand

language_aliases

This option allows you to define aliases for language names.

For example, to map conf to nginx and gitconfig to ini, you can use:

shiki:
  language_aliases:
    conf: nginx
    gitconfig: ini

After this configuration, code blocks marked with conf or gitconfig will be highlighted using the nginx and ini syntax rules, respectively.

style_to_class transformer

You can enable style_to_class to convert Shiki's inline styles into CSS classes. Example configuration:

shiki:
  style_to_class:
    enable: true
    class_prefix: _sk_

What this does:

  • When enabled, inline style attributes produced by Shiki are transformed into unique class names.
  • The class names are generated from a hash of the style object; use class_prefix to set a custom prefix for those class names.
  • A CSS file containing these generated class rules will be written to the ~/Download directory.
  • You must add a link to the generated CSS in your blog (for example in your theme's head) to apply the styles.

Here is an example of the difference in output

/* without style_to_class */
<span
  style="
    color: #d20f39;
    --shiki-light-font-style: italic;
    --shiki-dark: #f38ba8;
    --shiki-dark-font-style: italic;
    --shiki-tokyo: #c0caf5;
    --shiki-tokyo-font-style: italic;
  "
>
  Italic
</span>

/* with style_to_class */
<span class="_sk_1a2b3c">Italic</span>

This feature can help reduce HTML size, improve caching, and make it easier to customize styles via CSS.

Themes

Default themes: catppuccin-latte (light) and catppuccin-mocha (dark). You can define multiple themes for different modes, e.g.:

shiki:
  themes:
    light: "catppuccin-latte"
    dark: "catppuccin-mocha"
    tokyo: "tokyo-night"

The plugin may emit spans like:

<span style="color:#1E66F5;--shiki-dark:#89B4FA;--shiki-tokyo:#7AA2F7"
  >name</span
>

This plugin automatically switches to the dark theme when the page root has either:

  • data-theme="dark" or data-theme="night"
  • class="dark" or class="night"

For other theme-switching strategies, add your own logic.

Supported themes and languages are listed at Shiki Themes and Shiki Languages.

Use your own CSS

You can provide a custom CSS file to replace the default styles:

shiki:
  custom_css: "css/shiki-custom.css" # relative to `themes/<your_theme>/source`

Dev

For development, clone the repo and link it locally:

git clone https://github.com/Efterklang/hexo-shiki-highlight.git ~/Projects/hexo-dev/hexo-shiki-highlight
cd path_to_your_hexo_blog
bun i ~/Projects/hexo-dev/hexo-shiki-highlight
hexo clean
hexo s

Thanks