Skip to content

Commit

Permalink
Add defaultHandlers export
Browse files Browse the repository at this point in the history
Closes GH-58.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
  • Loading branch information
JounQin committed Dec 2, 2021
1 parent 893958f commit 3236b1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

export {one, all} from './lib/traverse.js'
export {toHast} from './lib/index.js'
export {defaultHandlers, toHast} from './lib/index.js'
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ import {one} from './traverse.js'
import {footer} from './footer.js'
import {handlers} from './handlers/index.js'

export {handlers as defaultHandlers}

const own = {}.hasOwnProperty

/**
Expand Down
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Which when running with `node example` yields:

## API

This package exports the following identifiers: `toHast`, `all`, `one`
This package exports the following identifiers: `toHast`, `defaultHandlers`, `all`, `one`
There is no default export.

### `toHast(node[, options])`
Expand Down Expand Up @@ -244,6 +244,11 @@ Yields, in [hast][] (**note**: the `pre` and `language-js` class are normal
}
```

### `defaultHandlers`

Object mapping mdast node types to functions that can handle them.
See [`lib/handlers/index.js`](./lib/handlers/index.js)

### `all(h, parent)`

Helper function for writing custom handlers passed to `options.handlers`.
Expand Down

0 comments on commit 3236b1e

Please sign in to comment.