Skip to content

Commit 2ab5984

Browse files
authored
Merge pull request #499 from code-hike/fix-values-with-break
Parse two values separated by a markdown break
2 parents 8540c25 + 360df6e commit 2ab5984

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

Diff for: .changeset/afraid-lies-shave.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"codehike": patch
3+
---
4+
5+
Parse two values separated by a markdown break

Diff for: packages/codehike/src/mdx/1.1.remark-list-to-section.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ function isImageAndParagraphs(child: any): child is {
216216
return (
217217
(c.type === "image" && c.alt?.startsWith("!")) ||
218218
(c.type === "text" && c.value.trim().startsWith("!")) ||
219-
(c.type === "text" && c.value.trim() === "")
219+
(c.type === "text" && c.value.trim() === "") ||
220+
c.type === "break"
220221
)
221222
})
222223
}

Diff for: packages/codehike/tests/md-suite/two-ps.0.mdx

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ cc
2525
ee ee
2626
ee
2727

28+
!k two-spaces-after-value
29+
!l because-some-use-prettier-proseWrap
30+
2831
## !invalid
2932

3033
ff ff

Diff for: packages/codehike/tests/md-suite/two-ps.2.before-remark.json

+8
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
"type": "paragraph",
5757
"children": [{ "type": "text", "value": "!e1 1\r\nee ee\r\nee" }]
5858
},
59+
{
60+
"type": "paragraph",
61+
"children": [
62+
{ "type": "text", "value": "!k two-spaces-after-value" },
63+
{ "type": "break" },
64+
{ "type": "text", "value": "!l because-some-use-prettier-proseWrap" }
65+
]
66+
},
5967
{
6068
"type": "heading",
6169
"depth": 2,

Diff for: packages/codehike/tests/md-suite/two-ps.8.parsed-jsx.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ jjj
8686
"2",
8787
],
8888
"e1": "1\r\nee ee\r\nee",
89+
"k": "two-spaces-after-value",
90+
"l": "because-some-use-prettier-proseWrap",
8991
"title": "",
9092
},
9193
}

0 commit comments

Comments
 (0)