|
1 | 1 | /** |
2 | 2 | * @typedef {import('unist').Parent} UnistParent |
3 | 3 | * @typedef {import('unist').Point} Point |
4 | | - * @typedef {import('mdast').Root} Root |
| 4 | + * @typedef {import('mdast').Association} Association |
5 | 5 | * @typedef {import('mdast').Content} Content |
6 | | - * @typedef {import('mdast').TopLevelContent} TopLevelContent |
7 | 6 | * @typedef {import('mdast').ListContent} ListContent |
8 | 7 | * @typedef {import('mdast').PhrasingContent} PhrasingContent |
| 8 | + * @typedef {import('mdast').Root} Root |
| 9 | + * @typedef {import('mdast').TopLevelContent} TopLevelContent |
9 | 10 | * @typedef {import('../index.js').ConstructName} ConstructName |
10 | 11 | */ |
11 | 12 |
|
|
73 | 74 | * @returns {Tracker} |
74 | 75 | * Tracker. |
75 | 76 | * |
| 77 | + * @callback AssociationId |
| 78 | + * Get an identifier from an association to match it to others. |
| 79 | + * |
| 80 | + * Associations are nodes that match to something else through an ID: |
| 81 | + * <https://github.com/syntax-tree/mdast#association>. |
| 82 | + * |
| 83 | + * The `label` of an association is the string value: character escapes and |
| 84 | + * references work, and casing is intact. |
| 85 | + * The `identifier` is used to match one association to another: |
| 86 | + * controversially, character escapes and references don’t work in this |
| 87 | + * matching: `©` does not match `©`, and `\+` does not match `+`. |
| 88 | + * |
| 89 | + * But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` |
| 90 | + * matches `a b`. |
| 91 | + * So, we do prefer the label when figuring out how we’re going to serialize: |
| 92 | + * it has whitespace, casing, and we can ignore most useless character |
| 93 | + * escapes and all character references. |
| 94 | + * @param {Association} node |
| 95 | + * Node that includes an association. |
| 96 | + * @returns {string} |
| 97 | + * ID. |
| 98 | + * |
76 | 99 | * @callback Map |
77 | 100 | * Map function to pad a single line. |
78 | 101 | * @param {string} value |
|
169 | 192 | * Positions of child nodes in their parents. |
170 | 193 | * @property {IndentLines} indentLines |
171 | 194 | * Pad serialized markdown. |
| 195 | + * @property {AssociationId} associationId |
| 196 | + * Get an identifier from an association to match it to others. |
172 | 197 | * @property {ContainerPhrasing} containerPhrasing |
173 | 198 | * Serialize the children of a parent that contains phrasing children. |
174 | 199 | * @property {ContainerFlow} containerFlow |
|
0 commit comments