unified

Project: micromark/micromark-extension-mdxjs

Package: micromark-extension-mdxjs@0.3.0

  1. Dependencies: 7·Dependents: 2
  2. micromark extension to support MDX.js
  1. unified 169
  2. markdown 142
  3. mdx 29
  4. jsx 17
  5. micromark 16
  6. micromark-extension 16
  7. mdxjs 8
  8. expression 5
  9. esm 3

micromark-extension-mdxjs

Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support MDX.js. Use micromark-extension-mdx instead to support MDX agnostic to JS.

This package provides the low-level modules for integrating with the micromark tokenizer but has no handling of compiling to HTML: go to a syntax tree instead.

You probably should use this package with mdast-util-mdx (mdast) or alternatively use both through remark-mdx (remark).

The extensions can be used separately:

Install

npm:

npm install micromark-extension-mdxjs

Use

See mdast-util-mdx for an example.

API

syntax(options)

Support MDX.js.

The export is a function that can be called to return an extension for the micromark parser (to tokenize MDX; can be passed in extensions).

options

Options are the same as for mdx-expression, mdx-jsx, and mdxjs-esm, but come predefined to support JS inside MDX.

options.acorn

Acorn parser to use (Acorn, default: acorn.Parser.extend(acornJsx())).

options.acornOptions

Options to pass to acorn (Object, default: {ecmaVersion: 2020, sourceType: 'module'}).

options.addResult

Whether to add an estree field to tokens with the results from acorn (boolean, default: true).

Contribute

See contributing.md in micromark/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer