Giter VIP home page Giter VIP logo

recma-mdx-is-mdx-component's Introduction

recma-mdx-is-mdx-component

github actions npm version npm downloads codecov

A recma plugin to define the isMDXComponent property on MDX components.

Table of Contents

Installation

npm install recma-mdx-is-mdx-component

Usage

This recma plugin assigns true to the property MDXContent.isMDXComponent.

For example, given a file named example.mdx with the following contents:

Some MDX content

The following script:

import { readFile } from 'node:fs/promises'

import { compile } from '@mdx-js/mdx'
import recmaPluginInjectisMDXComponent from 'recma-mdx-is-mdx-component'

const { contents } = await compile(await readFile('example.mdx'), {
  jsx: true,
  recmaPlugins: [recmaPluginInjectisMDXComponent]
})
console.log(contents)

Roughly yields:

MDXContent.isMDXComponent = true
export default function MDXContent() {
  return <p>Some MDX content</p>
}

API

The default export is a recma plugin. It takes no options.

Compatibility

This project is compatible with Node.js 16 or greater.

License

MIT © Remco Haszing

recma-mdx-is-mdx-component's People

Contributors

remcohaszing avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.