@mdx-js/tag

0.20.3 • Public • Published

@mdx-js/tag

Build Status lerna Join the community on Spectrum

Map components to HTML elements based on the Markdown syntax. Useful with MDX.

Installation

npm:

npm i -S @mdx-js/tag

Usage

import React from 'react'
import {renderToString} from 'react-dom/server'
import {MDXTag} from '@mdx/tag'

const H1 = props => <h1 style={{color: 'tomato'}} {...props} />

console.log(renderToString(<MDXTag name="h1" children="Hello, world!" />))
console.log(renderToString(<MDXTag name="h1" components={{h1: H1}} children="Hello, world!" />))

Yields:

<h1>Hello, world!</h1>
<h1 style="color:tomato">Hello, world!</h1>

Contribute

See contributing.md in mdx-js/mdx for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Compositor and ZEIT

Package Sidebar

Install

npm i @mdx-js/tag

Homepage

mdxjs.com/

Weekly Downloads

4,138

Version

0.20.3

License

MIT

Unpacked Size

9.44 kB

Total Files

6

Last publish

Collaborators