Skip to content

Commit c2badf5

Browse files
committed
fix: only preserveWhitespace on node content
See [this description for more details](#2230 (comment))
1 parent 743b0d6 commit c2badf5

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

packages/core/src/api/parsers/html/parseHTML.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function HTMLToBlocks<
2323

2424
const parentNode = parser.parse(htmlNode, {
2525
topNode: pmSchema.nodes["blockGroup"].create(),
26-
preserveWhitespace: true
2726
});
2827

2928
const blocks: Block<BSchema, I, S>[] = [];

packages/core/src/api/parsers/markdown/parseMarkdown.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ export function markdownToHTML(markdown: string): string {
9393
}
9494
},
9595
code,
96+
blockquote: (state: any, node: any) => {
97+
const result = {
98+
type: "element",
99+
tagName: "blockquote",
100+
properties: {},
101+
// The only difference from the original is that we don't wrap the children with line endings
102+
children: state.wrap(state.all(node), false),
103+
};
104+
state.patch(node, result);
105+
return state.applyData(node, result);
106+
},
96107
},
97108
})
98109
.use(rehypeStringify)

tests/src/unit/core/formatConversion/parse/__snapshots__/html/mixedTextTableCell.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
{
1616
"styles": {},
1717
"text": "Table Cell
18-
Table Cell Table Cell",
18+
Table Cell
19+
20+
Table Cell
21+
",
1922
"type": "text",
2023
},
2124
],

tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@
169169
"content": [
170170
{
171171
"styles": {},
172-
"text": "Paragraph With Hard Break",
172+
"text": "Paragraph
173+
With Hard Break",
173174
"type": "text",
174175
},
175176
],

0 commit comments

Comments
 (0)