|
25 | 25 | * @typedef {Record<string, unknown>} Properties
|
26 | 26 | *
|
27 | 27 | * @typedef Options
|
28 |
| - * @property {Record<string, Handle>} [handlers] |
29 |
| - * @property {boolean} [document] |
| 28 | + * Configuration (optional). |
30 | 29 | * @property {boolean} [newlines=false]
|
| 30 | + * Keep line endings when collapsing whitespace. |
| 31 | + * The default collapses to a single space. |
31 | 32 | * @property {string} [checked='[x]']
|
| 33 | + * Value to use for a checked checkbox or radio input. |
32 | 34 | * @property {string} [unchecked='[ ]']
|
| 35 | + * Value to use for an unchecked checkbox or radio input. |
33 | 36 | * @property {Array<string>} [quotes=['"']]
|
| 37 | + * List of quotes to use. |
| 38 | + * Each value can be one or two characters. |
| 39 | + * When two, the first character determines the opening quote and the second |
| 40 | + * the closing quote at that level. |
| 41 | + * When one, both the opening and closing quote are that character. |
| 42 | + * The order in which the preferred quotes appear determines which quotes to |
| 43 | + * use at which level of nesting. |
| 44 | + * So, to prefer `‘’` at the first level of nesting, and `“”` at the second, |
| 45 | + * pass `['‘’', '“”']`. |
| 46 | + * If `<q>`s are nested deeper than the given amount of quotes, the markers |
| 47 | + * wrap around: a third level of nesting when using `['«»', '‹›']` should |
| 48 | + * have double guillemets, a fourth single, a fifth double again, etc. |
| 49 | + * @property {boolean} [document] |
| 50 | + * Whether the given tree represents a complete document. |
| 51 | + * Applies when the `tree` is a `root` node. |
| 52 | + * When the tree represents a complete document, then things are wrapped in |
| 53 | + * paragraphs when needed, and otherwise they’re left as-is. |
| 54 | + * The default checks for whether there’s mixed content: some phrasing nodes |
| 55 | + * *and* some non-phrasing nodes. |
| 56 | + * @property {Record<string, Handle>} [handlers] |
| 57 | + * Object mapping tag names or node types to functions handling the |
| 58 | + * corresponding nodes. |
| 59 | + * See `handlers/` for examples. |
| 60 | + * |
| 61 | + * In a handler, you have access to `h`, which should be used to create mdast |
| 62 | + * nodes from hast nodes. |
| 63 | + * On `h`, there are several fields that may be of interest. |
| 64 | + * Most interesting of them is `h.wrapText`, which is `true` if the mdast |
| 65 | + * content can include newlines, and `false` if not (such as in headings or |
| 66 | + * table cells). |
34 | 67 | *
|
35 | 68 | * @typedef Context
|
36 | 69 | * @property {Record<string, Element>} nodeById
|
|
0 commit comments