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

rehype-typedoc

v0.2.0

Published

Rehype plugin to auto-link inline code to TypeDoc API documentation

Readme

rehype-typedoc

TypeDoc-aware markdown and HTML linking plugins for Unified pipelines.

Installation

npm install rehype-typedoc

For directive support (:typedoc[...] and ::typedoc{...}), also install remark-directive.

What It Does

  • Links inline <code> symbols to API docs.
  • Links identifiers inside syntax-highlighted TypeScript/JavaScript code blocks.
  • Adds directive helpers so docs authors can disambiguate symbol lookups and optionally inject signatures.

Exports

  • rehypeTypedoc (default): links inline code nodes.
  • rehypeTypedocCodeBlocks: links identifiers in <pre><code> blocks.
  • remarkCodeProps: converts :typedoc[...] and ::typedoc{...} directives to linkable code nodes.

Quick Start

import rehypeShiki from '@shikijs/rehype';
import rehypeStringify from 'rehype-stringify';
import remarkDirective from 'remark-directive';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import { unified } from 'unified';
import rehypeTypedoc, {
  rehypeTypedocCodeBlocks,
  remarkCodeProps,
  type RehypeTypedocOptions,
} from 'rehype-typedoc';

const options: RehypeTypedocOptions = {
  symbols: new Map([
    [
      'createMatcher',
      {
        name: 'createMatcher',
        package: 'devkit',
        path: '/api/devkit/create-matcher',
      },
    ],
  ]),
  buildLink: (symbol) => symbol.path,
};

const file = await unified()
  .use(remarkParse)
  .use(remarkDirective)
  .use(remarkCodeProps)
  .use(remarkRehype)
  .use(rehypeTypedoc, options)
  .use(rehypeShiki, { theme: 'github-dark', addLanguageClass: true })
  .use(rehypeTypedocCodeBlocks, options)
  .use(rehypeStringify)
  .process('Use `createMatcher` in your plugin.');

const html = String(file);

Symbol Resolution and Disambiguation

When the same symbol name exists in multiple packages, resolution order is:

  1. Use data-pkg when present.
  2. Filter out re-exports and use the defining symbol when only one remains.
  3. Throw an error if multiple defining symbols still remain.

Use :typedoc directive attributes to set data-pkg from markdown:

Use :typedoc[Config]{pkg=core} for core configuration.

Directive Syntax

Text directive:

:typedoc[createMatcher]{pkg=devkit}

Leaf directive (requires resolveSignature):

::typedoc{symbol="Plugin" pkg="devkit"}

Provide a resolver when using leaf directives:

unified().use(remarkCodeProps, {
  resolveSignature: (symbolName, pkg) => {
    // return a TypeScript signature string for this symbol
    return undefined;
  },
});

Styling

Generated links use class="typedoc-link", so you can style API links independently from normal prose links.

License

MIT