Socket
Book a DemoInstallSign in
Socket

ezmdx

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezmdx

MDX is easy.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

ezmdx

MDX is easy.

Usage

MDX

import { MDX } from 'ezmdx'

export default function Page() {
  return <MDX source="# Hello, world!" />
}

Outputs:

<h1>Hello, world!</h1>

compile

import { compile } from 'ezmdx'

const source = `---
title: This is a title.
---
This is a paragraph.
`

export default function Page() {
  const { frontmatter, content } = compile({ source })
  return (
    <>
      <h1>{frontmatter.title}</h1>
      {content}
    </>
  )
}

Outputs:

<h1>This is a title.</h1>
<p>This is a paragraph.</p>

Options

components

// This is much abstracted.
// See https://mdxjs.com/packages/react/#use for precise types.
{ components: { [key: JSX.ElementType]: (props: Props) => React.ReactNode } }

// Example:
{ components: { h1: ({ children }) => <h1>{children}</h1> } }
import type { MDXComponents } from 'ezmdx'
import { MDX } from 'ezmdx'

const components = {
  h1: ({ children }: { children: React.ReactNode }) => {
    return <h1 className="text-2xl font-bold">{children}</h1>
  },
} satisfies MDXComponents

export default function Page() {
  return <MDX source="# Hello, world!" options={{ components }} />
}

Outputs:

<h1 class="text-2xl font-bold">Hello, world!</h1>

FAQs

Package last updated on 15 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts