We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 993a5cb commit 57b0d05Copy full SHA for 57b0d05
lib/util/wrap.js
@@ -24,20 +24,28 @@ function wrap(nodes) {
24
25
queue.push(node)
26
} else {
27
- if (queue !== undefined) {
28
- result.push({type: 'paragraph', children: queue})
29
- queue = undefined
30
- }
31
-
+ flush()
32
result.push(node)
33
}
34
35
36
37
38
39
40
return result
+
+ function flush() {
+ if (queue !== undefined) {
+ if (
+ queue.length !== 1 ||
+ queue[0].type !== 'text' ||
41
+ (queue[0].value !== ' ' && queue[0].value !== '\n')
42
+ ) {
43
+ result.push({type: 'paragraph', children: queue})
44
+ }
45
46
47
+ queue = undefined
48
49
50
51
/* Check if there are non-inline MDAST nodes returned.
0 commit comments