0.5.0 • Published 4 months ago

@temelj/mdx-react v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 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

4 months ago

0.3.0

5 months ago

0.4.1

4 months ago

0.3.2

5 months ago

0.4.0

5 months ago

0.3.1

5 months ago

0.2.0

5 months ago

0.1.7

6 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago