Skip to content

Commit e32b4cc

Browse files
committed
Add docs for h.wrapText in readme.md
1 parent deee95e commit e32b4cc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function toMdast(tree, options) {
2020

2121
h.handlers = xtend(handlers, settings.handlers || {})
2222
h.augment = augment
23-
h.document = settings.document
2423

24+
h.document = settings.document
2525
h.checked = settings.checked || '[x]'
2626
h.unchecked = settings.unchecked || '[ ]'
2727
h.quotes = settings.quotes || ['"']
@@ -53,6 +53,7 @@ function toMdast(tree, options) {
5353
return augment(node, result)
5454
}
5555

56+
// To do: inline in a future major.
5657
// `right` is the finalized mdast node, created from `left`, a hast node.
5758
function augment(left, right) {
5859
if (left.position) {

readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ Object mapping tag names or [*types*][type] to functions handling those
7272
[*elements*][element] or [*nodes*][hast-node].
7373
See [`handlers/`][handlers] for examples.
7474

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

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

0 commit comments

Comments
 (0)