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

next-mdxld

v1.3.0

Published

MDX loader for Next.js with dynamic layouts and components

Readme

next-mdxld

npm version License: MIT

A NextJS plugin for MDXLD (MDX with YAML Linked Data frontmatter) that enables component and layout selection based on frontmatter $context and $type.

Quick Start

---
$id: https://example.com/blog/my-blog-post
$type: https://schema.org/BlogPosting
title: My Blog Post
author: John Doe
datePublished: 2024-01-15
---

export { layout, components } from 'https://esm.sh/@mdxui/shadcn'

# My Blog Post

This content will use the simple blog layout and shadcn components.

Features

  • 🚀 NextJS App Router Support
  • 📄 MDXLD Frontmatter Processing
  • 🎨 Dynamic Component Selection via $type
  • 📱 Flexible Layout System via $context
  • 🔄 Automatic Page Generation
  • 🎯 TypeScript Support

Installation

# Using pnpm (recommended)
pnpm add next-mdxld @next/mdx @mdx-js/loader @mdx-js/react @types/mdx
# Or using npm
npm install next-mdxld @next/mdx @mdx-js/loader @mdx-js/react @types/mdx

Setup

1. Configure Next.js for MDX

Create or update your next.config.js:

import createMDX from '@next/mdx'
import remarkMdxld from 'remark-mdxld'

/** @type {import('next').NextConfig} */
const nextConfig = {
  // Configure `pageExtensions` to include MDX files
  pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
  // Allow URL imports from trusted domains
  experimental: {
    urlImports: ['https://esm.sh']
  }
}

const withMDX = createMDX({
  // Add markdown plugins here
  options: {
    remarkPlugins: [remarkMdxld],
    rehypePlugins: []
  }
})

// Merge MDX config with Next.js config
export default withMDX(nextConfig)

2. Set up MDX Components

Create mdx-components.tsx in your project root:

import React from 'react'
import type { MDXComponents } from 'mdx/types'
import { defaultLayouts } from 'next-mdxld/layouts'

export function useMDXComponents(components: MDXComponents): MDXComponents {
  return {
    wrapper: ({ children, frontmatter }) => {
      const Layout = frontmatter?.$type ?
        defaultLayouts[frontmatter.$type] || defaultLayouts.default :
        defaultLayouts.default

      return <Layout frontmatter={frontmatter}>{children}</Layout>
    },
    ...components
  }
}

3. Create App Layout

import { Layout } from 'next-mdxld/components'

export default function RootLayout({ children }) {
  return (
    <Layout>
      {children}
    </Layout>
  )
}

4. Set up Dynamic Page Route

import { MDXPage } from 'next-mdxld/page'

export default MDXPage

Example MDX Files

Schema.org BlogPosting

---
$type: https://schema.org/BlogPosting
title: My Technical Blog Post
author: John Doe
datePublished: 2024-01-15
---

# Advanced TypeScript Patterns

This content will be rendered using the BlogPosting component within the Blog layout.

Schema.org WebSite

---
$type: https://schema.org/WebSite
name: My Developer Portfolio
url: https://example.com
---

# Welcome to My Portfolio

This content uses the WebSite component for optimal SEO and structure.

mdx.org.ai API

---
$type: https://mdx.org.ai/API
endpoint: /api/users
method: POST
---

# Create User API

This content will be rendered with API-specific components and documentation layout.

mdx.org.ai Agent

---
$type: https://mdx.org.ai/Agent
tools: ["chat", "search", "code"]
---

# Support Agent

This content will be rendered with Agent-specific components and interaction UI.

Documentation

For detailed documentation and examples, visit:

Contributing

Please read our Contributing Guide to learn about our development process.

License

MIT © AI Primitives