0.5.0 • Published 9 months ago

@temelj/mdx-react v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Installation

# npm
$ npm install @temelj/mdx-react
# jsr
$ deno add jsr:@temelj/mdx-react # or jsr add @temelj/mdx-react

Usage

To render the MDX artifact, you call the createMdxContent function. It will evaluate the compiled "function body" and return a React node. You can also override components with your custom ones.

import { createMdxContent, MdxCompiler } from "@temelj/mdx";

const compiler = new MdxCompiler();
const page = await compiler.compile(source, {
  mdxOptions: {
    // This is always 'function-body'.
    // outputFormat: "function-body",
    // Or 'undefined' if rendering server-side as a RSC.
    providerImportSource: "@mdx-js/react",
  },
});

const node = createMdxContent({ artifact: page }, mdxPageComponents);

const rendered = <div>{node}</div>;

You will also need to include a CSS file. You can find an example in ./examples/mdx-react/basic.

0.5.0

9 months ago

0.3.0

10 months ago

0.4.1

9 months ago

0.3.2

10 months ago

0.4.0

10 months ago

0.3.1

10 months ago

0.2.0

10 months ago

0.1.7

11 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago