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

shiki-tinymist

v0.1.0

Published

A Shiki transformer that enriches Typst code blocks with Tinymist WASM language-service hovers.

Readme

shiki-tinymist

A Shiki transformer for Typst code blocks powered by the Tinymist WASM language server.

The package queries the Tinymist WASM LSP bridge before Shiki renders a code block, then attaches hover data at // ^? marker positions.

Install

npm install shiki-tinymist shiki

Tinymist's WASM runtime is bundled with shiki-tinymist, so consumers do not need to install a separate tinymist package.

Usage

import { codeToHtml } from "shiki";
import { createTinymistTransformer } from "shiki-tinymist";

const code = `#let answer = 42
//   ^?`;

const transformer = await createTinymistTransformer(code);

const html = await codeToHtml(code, {
  lang: "typst",
  theme: "vitesse-dark",
  transformers: [transformer],
});

When used in Markdown integrations, set explicitTrigger: true to only run on code fences with tinymist or typst-lsp in the meta string.

```typst tinymist
#let answer = 42
//   ^?
```

Import the default styles:

import "shiki-tinymist/style-rich.css";

For scrollable code containers, install the small floating client so hover popups are moved outside the code block before they are positioned:

import { initTinymistFloating } from "shiki-tinymist/client";

initTinymistFloating();

Framework Adapters

Tinymist queries are asynchronous, so the framework adapters prepare Typst fences before the normal Markdown renderer finishes.

Rehype

import rehypeStringify from "rehype-stringify";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import { unified } from "unified";
import { rehypeTinymist } from "shiki-tinymist/rehype";

const html = await unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypeTinymist({ explicitTrigger: true }))
  .use(rehypeStringify)
  .process(markdown);

markdown-it

markdown-it renders synchronously, so the adapter adds an async renderTinymist helper instead of replacing the sync fence renderer.

import MarkdownIt from "markdown-it";
import { markdownItTinymist } from "shiki-tinymist/markdown-it";

const md = new MarkdownIt({ html: true });
md.use(markdownItTinymist({ explicitTrigger: true }));

const html = await md.renderTinymist(markdown);

VitePress

import { defineConfig } from "vitepress";
import { vitepressTinymist } from "shiki-tinymist/vitepress";

export default defineConfig({
  vite: {
    plugins: [vitepressTinymist({ explicitTrigger: true })],
  },
});

Astro

import { defineConfig } from "astro/config";
import { astroTinymist } from "shiki-tinymist/astro";

export default defineConfig({
  integrations: [astroTinymist({ explicitTrigger: true })],
});

MDX

import { mdxTinymist } from "shiki-tinymist/mdx";

export default {
  rehypePlugins: [mdxTinymist({ explicitTrigger: true })],
};

Next

import createMDX from "@next/mdx";
import { nextTinymist } from "shiki-tinymist/next";

const withMDX = createMDX({
  options: {
    rehypePlugins: [nextTinymist({ explicitTrigger: true })],
  },
});

export default withMDX({
  pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
});

Nuxt

export default defineNuxtConfig({
  css: ["shiki-tinymist/style-rich.css"],
  content: {
    build: {
      markdown: {
        rehypePlugins: {
          "shiki-tinymist/nuxt": { explicitTrigger: true },
        },
      },
    },
  },
});

Full-feature examples for every adapter live in examples/.

Documentation Site

The documentation site is an Astro Starlight project in docs/. Adapter pages are generated from docs/src/data/adapters.mjs and reuse the runnable fixtures in examples/, so adding an adapter updates the sidebar, overview, preview, and source panels from one registry.

npm run docs:dev
npm run docs:build

The documentation site uses Astro and requires Node.js 22.12 or newer.

GitHub Pages deployment is still handled by .github/workflows/pages.yml. The workflow builds the Starlight site with the GitHub Pages base path and uploads docs/dist.

Marker Syntax

Use a Typst line comment under the target code.

Hover query:

#let answer = 42
//   ^?

Completion query:

#ans
//    ^|

Static highlight:

#answer
// ^^^^^^

Marker lines are removed before Shiki highlights the code.

Twoslash Compatibility

shiki-tinymist supports the Twoslash-style notation that maps cleanly to Typst/Tinymist:

| Notation | Status | Behavior | | ----------------------------------------- | ---------- | ------------------------------------------------------------------------------------------ | | // ^? | supported | Queries Tinymist hover and renders it on the target range. | | // ^\| | supported | Queries Tinymist completions and renders up to 5 inline items by default. | | // ^^^ | supported | Highlights the target range without an LSP query. | | // ---cut--- / // ---cut-before--- | supported | Hides previous lines from output while keeping them in the Tinymist query. | | // ---cut-after--- | supported | Hides following lines from output while keeping them in the Tinymist query. | | // ---cut-start--- / // ---cut-end--- | supported | Hides paired output ranges while keeping them in the Tinymist query. | | // @filename: name.typ | supported | Splits the query into virtual files; the filename comment remains visible unless cut away. | | // @noErrors | supported | Suppresses rendered diagnostics. | | // @errors: text | supported | Renders diagnostics whose code or message includes one of the listed tokens. | | // @showEmit / // @showEmittedFile | recognized | Removed from output, but no Typst emit replacement is produced. | | Other // @name options | recognized | Removed from output and exposed in ParsedTinymistCode.directives. |

Development

Tinymist is tracked as a git submodule. Its WASM package is intentionally not built by npm run build; build it manually when setting up the repo or when updating the submodule.

git submodule update --init --recursive
npm run tinymist:build
npm install
npm run demo
npm test
npm run typecheck
npm run build

npm run demo writes demo/index.html.

Why a Prepare Step?

Shiki transformer hooks are synchronous, while WASM/LSP calls are asynchronous. The package therefore queries Tinymist before calling codeToHtml, then passes a synchronous transformer to Shiki.