Skip to content

Commit 8ffb451

Browse files
committed
Updated logic & tests for new Markdown to HTML converter
1 parent 19564d4 commit 8ffb451

6 files changed

Lines changed: 34 additions & 18 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function trySoftBreak(
139139
i: number
140140
): { html: string; end: number } | null {
141141
if (text[i] === "\n") {
142-
return { html: "\n", end: i + 1 };
142+
return { html: "<br>\n", end: i + 1 };
143143
}
144144
return null;
145145
}

tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/blockquoteLazyContinuation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"content": [
55
{
66
"styles": {},
7-
"text": "This is a quote that continues here and here too",
7+
"text": "This is a quote
8+
that continues here
9+
and here too",
810
"type": "text",
911
},
1012
],

tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/blockquoteMultiline.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"content": [
55
{
66
"styles": {},
7-
"text": "Line one Line two Line three",
7+
"text": "Line one
8+
Line two
9+
Line three",
810
"type": "text",
911
},
1012
],
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[
2+
{
3+
"children": [],
4+
"content": [
5+
{
6+
"styles": {},
7+
"text": "Line one
8+
Line two
9+
Line three",
10+
"type": "text",
11+
},
12+
],
13+
"id": "1",
14+
"props": {
15+
"backgroundColor": "default",
16+
"textAlignment": "left",
17+
"textColor": "default",
18+
},
19+
"type": "paragraph",
20+
},
21+
]

tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/paragraphLeadingIndent.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"content": [
55
{
66
"styles": {},
7-
"text": "aaa bbb",
7+
"text": "aaa
8+
bbb",
89
"type": "text",
910
},
1011
],

tests/src/unit/core/formatConversion/parse/parseTestInstances.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,17 +1121,6 @@ Paragraph
11211121
* Bullet List Item
11221122
11231123
1. Numbered List Item
1124-
`,
1125-
},
1126-
executeTest: testParseMarkdown,
1127-
},
1128-
{
1129-
testCase: {
1130-
name: "singleNewLines",
1131-
content: `Line 1
1132-
Line 2
1133-
Line 3
1134-
Line 4
11351124
`,
11361125
},
11371126
executeTest: testParseMarkdown,
@@ -1700,12 +1689,13 @@ Third paragraph`,
17001689
},
17011690
executeTest: testParseMarkdown,
17021691
},
1703-
// Paragraph continuation (lines without blank line)
1692+
// Line breaks
17041693
{
17051694
testCase: {
1706-
name: "paragraphContinuation",
1695+
name: "lineBreaks",
17071696
content: `Line one
1708-
still same paragraph`,
1697+
Line two
1698+
Line three`,
17091699
},
17101700
executeTest: testParseMarkdown,
17111701
},

0 commit comments

Comments
 (0)