Closes GH-61. Closes GH-62.
Reviewed-by: Titus Wormer <tituswormer@gmail.com>
3 | 3 | * @typedef {import('../index.js').Handler} Handler |
|
4 | 4 | */ |
|
5 | 5 | ||
6 | + | import {trimLines} from 'trim-lines' |
|
6 | 7 | import {u} from 'unist-builder' |
|
7 | 8 | ||
8 | 9 | /** |
10 | 11 | * @param {Text} node |
|
11 | 12 | */ |
|
12 | 13 | export function text(h, node) { |
|
13 | - | return h.augment( |
|
14 | - | node, |
|
15 | - | u('text', String(node.value).replace(/[ \t]*(\r?\n|\r)[ \t]*/g, '$1')) |
|
16 | - | ) |
|
14 | + | return h.augment(node, u('text', trimLines(String(node.value)))) |
|
17 | 15 | } |