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

docusaurus-plugin-embeds

v0.1.0

Published

Docusaurus components for rich link, GitHub, npm, and YouTube embeds

Readme

Docusaurus plugin embeds

Rich MDX embeds for arbitrary links, GitHub repositories, npm packages, and YouTube videos.

The plugin registers its components globally, so MDX files can use them without an import. The cards follow Docusaurus theme variables and work in light and dark modes.

Install

npm install docusaurus-plugin-embeds

Add the plugin to docusaurus.config.js:

export default {
  plugins: ['docusaurus-plugin-embeds'],
};

The components are then available in any MDX document:

<GitHubRepoCard repo="facebook/docusaurus" />

<NpmPackageCard package="@docusaurus/core" />

<YouTube id="dQw4w9WgXcQ" title="A useful description of the video" />

<RichLinkCard url="https://docusaurus.io/blog/releases/3.0" />

Components

RichLinkCard

Displays a static preview for an arbitrary HTTP link using Open Graph, Twitter Card, or standard HTML metadata. The plugin finds literal URLs in RichLinkCard and LinkCard elements, resolves them during the build, and caches the result. Readers don't make metadata requests.

<RichLinkCard url="https://example.com/article" />

<RichLinkCard
  url="https://example.com/private-page"
  title="Metadata can be supplied explicitly"
  description="Explicit values override fetched metadata."
  image="https://example.com/cover.jpg"
/>

| Prop | Type | Required | Default | Description | | ------------- | --------------------------- | -------- | ------- | --------------------------------------------- | | url | string | Yes | | Absolute HTTP or HTTPS destination. | | title | string | No | | Overrides the fetched title. | | description | string | No | | Overrides the fetched description. | | image | string | No | | Overrides the fetched preview image. | | siteName | string | No | | Overrides the fetched site name. | | favicon | string | No | | Overrides the fetched favicon. | | fallback | link \| compact \| hidden | No | link | Rendering used when metadata isn't available. | | className | string | No | | Additional class for the card. | | style | React.CSSProperties | No | | Inline styles for layout overrides. |

LinkCard is available as an MDX alias. Explicit React imports use RichLinkCard.

GitHubRepoCard

Displays a repository's description, visibility, stars, forks, primary language, license, update date, and topics. Repository data comes from GitHub's public API in the reader's browser.

| Prop | Type | Required | Description | | ----------- | --------------------------- | -------- | ------------------------------------ | | repo | string | Yes | Repository in owner/name format. | | className | string | No | Additional class for the card. | | style | React.CSSProperties | No | Inline styles for layout overrides. | | fallback | link \| compact \| hidden | No | Rendering used after an API failure. |

NpmPackageCard

Displays the latest version, description, weekly downloads, license, update date, and keywords. Package data comes from the npm registry and downloads APIs in the reader's browser.

| Prop | Type | Required | Description | | ----------- | --------------------------- | -------- | ------------------------------------ | | package | string | Yes | npm package name, including scopes. | | className | string | No | Additional class for the card. | | style | React.CSSProperties | No | Inline styles for layout overrides. | | fallback | link \| compact \| hidden | No | Rendering used after an API failure. |

YouTube

Displays a responsive, lazy-loaded video using YouTube's privacy-enhanced embed host.

| Prop | Type | Required | Default | Description | | ------------- | --------------------------- | -------- | ---------------------- | -------------------------------------- | | id | string | Yes | | YouTube video ID. | | title | string | No | YouTube video player | Accessible iframe title. | | aspectRatio | CSS aspect-ratio | No | 16 / 9 | Video aspect ratio. | | className | string | No | | Additional class for the container. | | fallback | link \| compact \| hidden | No | link | Rendering used when no ID is supplied. |

Explicit imports

React code outside MDX can import components directly. Import the stylesheet once near the root of the app:

import 'docusaurus-plugin-embeds/styles.css';
import {
  GitHubRepoCard,
  NpmPackageCard,
  RichLinkCard,
  YouTube,
} from 'docusaurus-plugin-embeds/client';

Moving existing components

After installing the plugin in an existing Docusaurus site:

  1. Add docusaurus-plugin-embeds to the site's plugins array.
  2. Remove local imports such as @site/src/components/YouTube from MDX files.
  3. Leave the component markup unchanged.
  4. Delete the old local components and the shared formatNumber helper once nothing imports them.

API behavior

GitHub and npm cards fetch public data after hydration. Their initial server-rendered HTML contains a loading state and a working destination link. If an API is unavailable or rate-limited, the card remains a usable link and shows an unavailable state.

The plugin doesn't accept or expose API tokens. Sites that need authenticated requests, fixed build output, or strict content security policies should proxy or prefetch this data themselves.

Rich-link build behavior

By default, the plugin scans docs, blog, and src/pages for literal url props. Expressions such as url={article.url} can't be discovered, so supply metadata explicitly when using them.

Metadata is cached under node_modules/.cache/docusaurus-plugin-embeds for 24 hours. Stale data remains available when a refresh fails. Configure the scan and cache when registering the plugin:

export default {
  plugins: [
    [
      'docusaurus-plugin-embeds',
      {
        include: ['docs', 'src/pages'],
        cacheDir: '.cache/embeds',
        cacheTime: 7 * 24 * 60 * 60 * 1000,
      },
    ],
  ],
};

The resolver accepts only HTTP and HTTPS, rejects credentials and private network destinations, checks every redirect, limits redirects and response size, and times out slow requests. These checks matter because arbitrary build-time fetching can otherwise become an SSRF path.

Development

npm test
npm run typecheck
npm run lint
npm run build
npm run build:example

Requires Node.js 20 or newer.

License

MIT