Skip to content

Commit

Permalink
Add docs for h.wrapText in readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Mar 8, 2020
1 parent deee95e commit e32b4cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function toMdast(tree, options) {

h.handlers = xtend(handlers, settings.handlers || {})
h.augment = augment
h.document = settings.document

h.document = settings.document
h.checked = settings.checked || '[x]'
h.unchecked = settings.unchecked || '[ ]'
h.quotes = settings.quotes || ['"']
Expand Down Expand Up @@ -53,6 +53,7 @@ function toMdast(tree, options) {
return augment(node, result)
}

// To do: inline in a future major.
// `right` is the finalized mdast node, created from `left`, a hast node.
function augment(left, right) {
if (left.position) {
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ Object mapping tag names or [*types*][type] to functions handling those
[*elements*][element] or [*nodes*][hast-node].
See [`handlers/`][handlers] for examples.

In a handler, you have access to `h`, which should be used to create mdast nodes
from hast nodes.
On `h`, there are fields that may be of interest.
Most interesting of them is `h.wrapText`, which is `true` if the mdast content
can include newlines, and `false` if not (such as in headings or table cells).

###### `options.document`

Whether the given [*tree*][tree] is a complete document.
Expand Down

0 comments on commit e32b4cc

Please sign in to comment.