Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export {all} from './lib/all.js'
export {one} from './lib/one.js'
export {toHast} from './lib/index.js'
14 changes: 13 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`.
This package exports the following identifiers: `toHast`, `all`, `one`
There is no default export.

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

### `all(h, parent)`

Helper function for writing custom handlers passed to `options.handlers`.
Pass it `h` and a parent node (mdast) and it will turn the node’s children into
an array of transformed nodes (hast).

### `one(h, node, parent)`

Helper function for writing custom handlers passed to `options.handlers`.
Pass it `h`, a `node`, and its `parent` (mdast) and it will turn `node` into
hast content.

## Security

Use of `mdast-util-to-hast` can open you up to a
Expand Down