Skip to content

Commit

Permalink
Nuemark: parser no longer hangs with unclosed images. nuejs#379
Browse files Browse the repository at this point in the history
  • Loading branch information
tipiirai authored and nobkd committed Nov 14, 2024
1 parent f5e8783 commit 7d7556b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/nuemark/src/parse-inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ const PARSERS = [
if (img) {
img.end++
return img && { is_image: true, ...img }
} else {
return { text: char0 }
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions packages/nuemark/test/inline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ test('render image', () => {
expect(html).toBe('<img src="/bar.png" alt="foo" loading="lazy"> post')
})

test('unclosed image', () => {
expect(renderInline('![foo]')).toStartWith('!<foo custom')
})


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

0 comments on commit 7d7556b

Please sign in to comment.