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

sanity-plugin-tnd-docs

v1.0.4

Published

Adding documentation to your Sanity Studio using markdown files

Readme

sanity-plugin-tnd-docs

A Sanity Studio v3 plugin for displaying markdown documentation directly in your studio.

Installation

npm install sanity-plugin-tnd-docs

Usage

Add the plugin to your sanity.config.ts (or .js):

import { defineConfig } from 'sanity'
import { tndDocs } from 'sanity-plugin-tnd-docs'

// Import your markdown files using Vite's import.meta.glob
const docs = import.meta.glob('/docs/**/*.md', { eager: true, query: '?raw', import: 'default'})

export default defineConfig({
  // ...
  plugins: [
    tndDocs({
      documents: docs
    })
  ]
})

Configuration Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | documents | Record<string, string> | Yes | - | Markdown files loaded via import.meta.glob | | name | string | No | 'tnd-docs' | Internal name for the tool. Will determine route in studio | | title | string | No | 'Documentation' | Display title in Sanity Studio |

Setting Up Your Documentation Files

1. Create a docs folder in your project

your-sanity-project/
├── docs/
│   ├── getting-started.md
│   ├── endpoints.md
│   ├── authentication.md
│   └── guides.md

2. Import markdown files

The plugin uses Vite's import.meta.glob to load markdown files at build time. This must be done in your sanity.config.ts:

// Load all .md files from the /docs directory
const docs = import.meta.glob('/docs/**/*.md', {
  eager: true,
  query: '?raw',
  import: 'default'
})

Example: Complete Configuration

import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import { tndDocs } from 'sanity-plugin-tnd-docs'

// Load documentation files
const docs = import.meta.glob('/docs/**/*.md', { eager: true, as: 'raw' })

export default defineConfig({
  name: 'default',
  title: 'My Project',

  projectId: 'your-project-id',
  dataset: 'production',

  plugins: [
    structureTool(),
    tndDocs({
      title: 'Project Docs',
      documents: docs
    })
  ],

  schema: {
    types: [/* your schemas */]
  }
})

⚠️ The glob pattern must be a literal string - you cannot use variables:

// ✅ Correct
const docs = import.meta.glob('/docs/**/*.md', { eager: true, as: 'raw' })

// ❌ Incorrect - will not work
const path = '/docs/**/*.md'
const docs = import.meta.glob(path, { eager: true, as: 'raw' })

Markdown Syntax

Useful frontmatter

Currently the only frontmatter needed is:

| Name | Type | Required | Description | |--------|------|----------|-------------| | title | number | No | Will be used to populate the title of the entry in the side navigation. If missing, the path will be used | | weight | string | No | Will be used to sort the entries in the side navigation | | description | string | No | Will be printed in small text in the navigation entry |

Images

Sanity will copy the static directory as is, so you should use it to store your md images.

![This is the title attribute](/static/uploads/title-formating.png "This is a caption")

License

MIT © The New Dynamic

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.