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 56c44d9 commit 229552cCopy full SHA for 229552c
src/utils/unist.mjs
@@ -16,8 +16,14 @@ export const transformNodeToString = node => {
16
return `**${transformNodesToString(node.children)}**`;
17
case 'emphasis':
18
return `_${transformNodesToString(node.children)}_`;
19
- default:
20
- return node.children ? transformNodesToString(node.children) : node.value;
+ default: {
+ if (node.children) {
21
+ return transformNodesToString(node.children);
22
+ }
23
+
24
+ // Replace line breaks (\n) with spaces to keep text in a single line
25
+ return node.value?.replace(/\n/g, ' ') || '';
26
27
}
28
};
29
0 commit comments