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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@terwer/typedoc-vitepress-theme

v1.0.0-next.0-terwer.1

Published

A typedoc-plugin-markdown theme that publishes Markdown pages compatible with VitePress.

Downloads

5

Readme

typedoc-vitepress-theme

A typedoc-plugin-markdown theme that publishes Markdown pages compatible with VitePress.

npm CI

What does it do?

  • Presets relevant options of typedoc-plugin-markdown targetting VitePress Markdown.
  • Auto generates a VitePress sidebar that can be referenced from the VitePress config.

What about VuePress?

This theme is also compatible with VuePress and the configuration is almost identical. However this theme supersedes previous VuePress TypeDoc plugins and is specifically targetted for VitePress.

See https://vitepress.dev/guide/what-is-vitepress#what-about-vuepress.

Installation

1. Install VitePress

https://vitepress.dev/guide/getting-started

2. Install plugin

Install the plugin in the same location as your VitePress installation.

typedoc and typedoc-plugin-markdown are required peer dependencies.

npm install typedoc typedoc-plugin-markdown@next typedoc-vitepress-theme@next --save-dev

Typical file structure

.
├─ docs
│ ├─ .vitepress
│ │ └─ config.js
│ └─ api (default out dir containing generated TypeDoc pages and typedoc-sidebar.json file)
└─ package.json (package.json project root)

Usage

Create a script that builds TypeDoc pages before bootstraping VitePress. The following is a guideline only and can be tailored as required.

1. Create a script to publish TypeDoc pages

"publish-typedoc": "typedoc --options typedoc.json"

typedoc.json

{
  "plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"]
}

2. Run the script before bootstrapping VitePress

"docs:dev": "npm run publish-typedoc && vitepress dev docs",
"docs:build": "npm run publish-typedoc && vitepress build docs"

3. Configure Navbar and Sidebar

A sidebar named typedoc-sidebar.json is auto-generated to the out directory. This can then be referenced in the config file to configure the sidebar.

docs/.vitepress/config.ts

import typedocSidebar from '../api/typedoc-sidebar.json';

module.exports = {
  themeConfig: {
    nav: [{ text: 'API', link: '/api/' }],
    sidebar: [
      {
        text: 'API',
        items: typedocSidebar,
      },
    ],
  },
};

Options

Options can be declared:

  • Passing arguments via the command line.
  • Using a typedoc.json file.
  • Under the typedocOptions key in tsconfig.json.

Please see https://typedoc.org/options/configuration for general TypeDoc option configuration.

TypeDoc options

The following TypeDoc / Markdown plugin options can be passed to config:

The following typedoc-plugin-markdown options are preset with the theme.

{
  "anchorFormat": "slug",
  "entryDocument": "index.md",
  "hideBreadcrumbs": true,
  "hidePageHeader": true,
  "out": "./docs/api"
}

Theme options

The following theme options are also exposed, but the defaults should work for most use cases.

--sidebar

sidebar.autoConfiguration

Set to false to disable sidebar generation. Defaults to true.

sidebar.format

The format of the sidebar. This option is exposed to enable backward compatibility with VuePress sidebars. Available options [vitepress vuepress1, vuepress2]. Defaults to vitepress.

{
  "sidebar": {
    "autoConfiguration": true,
    "format": "vitepress"
  }
}

--docsRoot

The VitePress docs folder root. Use ./ if no root folder specified. Defaults to ./docs.

--docsRoot <path/to/vitepress-docs/>

Frontmatter

Frontmatter can be added to pages by installing typedoc-plugin-frontmatter and adding to the plugin list.

{
  "plugin": [..., "typedoc-plugin-frontmatter"]
}

License

MIT