render markdown heading in react
npm install @yozora/react-heading
@yozora/react-heading
alt="Npm Version"
src="https://img.shields.io/npm/v/@yozora/react-heading.svg"
/>
alt="Npm Download"
src="https://img.shields.io/npm/dm/@yozora/react-heading.svg"
/>
alt="Npm License"
src="https://img.shields.io/npm/l/@yozora/react-heading.svg"
/>
alt="Module formats: cjs, esm"
src="https://img.shields.io/badge/module_formats-cjs%2C%20esm-green.svg"
/>
alt="Node.js Version"
src="https://img.shields.io/node/v/@yozora/react-heading"
/>
alt="React version"
src="https://img.shields.io/npm/dependency-version/@yozora/react-heading/peer/react"
/>
alt="Tested with Jest"
src="https://img.shields.io/badge/tested_with-jest-9c465e.svg"
/>
alt="Code Style: prettier"
src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"
/>
This component is for rendering the [Heading][@yozora/ast] data produced by
[@yozora/tokenizer-heading][].\
This component has been built into [@yozora/react-markdown][], you can use it directly.
* npm
``bash`
npm install --save @yozora/react-heading
* yarn
`bash`
yarn add @yozora/react-heading
* Basic:
`tsx
import React from 'react'
import Heading from '@yozora/react-heading'
import '@yozora/react-heading/lib/esm/index.css'
const wrapper = (
identifier="heading-waw"
style={{ color: 'orange', fontSize: '16px' }}
>
Heading waw, 中文标题“这”
)
`
Name | Type | Required | Default | Description
:------------:|:---------------------:|:---------:|:-------:|:-------------
children | React.ReactNode | false | - | Heading contentsclassName | string | false | - | Root css classidentifier | string | false | - | Heading identifierlevel | 1|2|3|4|5|6 | true | - | Heading levellinkIcon | React.ReactNode | false | '¶' | Heading link iconstyle | React.CSSProperties | false | - | Root css style
* className: The root element of this component will always bind with the'yozora-heading'`
CSS class
* [@yozora/ast][]
* [@yozora/react-markdown][]
* [@yozora/tokenizer-heading][]
* [Heading | Mdast][mdast]
[@yozora/ast]: https://www.npmjs.com/package/@yozora/ast#heading
[@yozora/react-markdown]: https://www.npmjs.com/package/@yozora/react-markdown
[@yozora/tokenizer-heading]: https://www.npmjs.com/package/@yozora/tokenizer-heading
[mdast]: https://github.com/syntax-tree/mdast#heading