Skip to content

Commit 3964d1f

Browse files
committed
Nuemark: parser no longer hangs with unclosed images. #379
1 parent ccc7a49 commit 3964d1f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/nuemark/src/parse-inline.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ const PARSERS = [
100100
if (img) {
101101
img.end++
102102
return img && { is_image: true, ...img }
103+
} else {
104+
return { text: char0 }
103105
}
104106
}
105107
},

packages/nuemark/test/inline.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ test('render image', () => {
8383
expect(html).toBe('<img src="/bar.png" alt="foo" loading="lazy"> post')
8484
})
8585

86+
test('unclosed image', () => {
87+
expect(renderInline('![foo]')).toStartWith('!<foo custom')
88+
})
89+
8690

8791
test('inline code', () => {
8892
const html = renderInline('Hey `[zoo] *boo*`')

0 commit comments

Comments
 (0)