Skip to content

Commit

Permalink
Add exports of defaultHandlers, all, one
Browse files Browse the repository at this point in the history
Closes GH-23.

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
JounQin committed Dec 3, 2021
1 parent e071630 commit f22d7af
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

import remarkRehype from './lib/index.js'

export {defaultHandlers, all, one} from 'mdast-util-to-hast'

export default remarkRehype
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dependencies": {
"@types/hast": "^2.0.0",
"@types/mdast": "^3.0.0",
"mdast-util-to-hast": "^12.0.0",
"mdast-util-to-hast": "^12.1.0",
"unified": "^10.0.0"
},
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
* [Use](#use)
* [API](#api)
* [`unified().use(remarkRehype[, destination][, options])`](#unifieduseremarkrehype-destination-options)
* [`defaultHandlers`](#defaulthandlers)
* [`one`](#one)
* [`all`](#all)
* [Examples](#examples)
* [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely)
* [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly)
Expand Down Expand Up @@ -272,6 +275,21 @@ to the documentation available in [`mdast-util-to-hast`][mdast-util-to-hast].
This option is a bit advanced as it requires knowledge of ASTs, so we defer
to the documentation available in [`mdast-util-to-hast`][mdast-util-to-hast].

### `defaultHandlers`

Re-exported [`defaultHandlers`](https://github.com/syntax-tree/mdast-util-to-hast#defaulthandlers)
from `mdast-util-to-hast`.

### `one`

Re-exported [`one`](https://github.com/syntax-tree/mdast-util-to-hast#one) from
`mdast-util-to-hast`.

### `all`

Re-exported [`all`](https://github.com/syntax-tree/mdast-util-to-hast#all) from
`mdast-util-to-hast`.

## Examples

### Example: supporting HTML in markdown naïvely
Expand Down
10 changes: 9 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkMarkdown from 'remark-stringify'
import rehypeStringify from 'rehype-stringify'
import remarkRehype from './index.js'
import remarkRehype, {defaultHandlers, all, one} from './index.js'

test('exports', (t) => {
t.assert(defaultHandlers, 'should export `defaultHandlers`')
t.assert(one, 'should export `one`')
t.assert(all, 'should export `all`')

t.end()
})

test('remarkRehype', (t) => {
t.equal(
Expand Down

0 comments on commit f22d7af

Please sign in to comment.