diff --git a/patterns.js b/patterns.js index 9851122..070f9e3 100644 --- a/patterns.js +++ b/patterns.js @@ -31,9 +31,12 @@ module.exports = [ } }, { /** - * bla `click()`{.c} + * bla `click()`{.c} ![](img.png){.d} + * + * differs from 'inline attributes' as it does + * not have a closing tag (nesting: -1) */ - name: 'code inline', + name: 'inline nesting 0', tests: [ { shift: 0, @@ -41,7 +44,7 @@ module.exports = [ children: [ { shift: -1, - type: 'code_inline' // does not have nesting: -1 + type: (str) => str === 'image' || str === 'code_inline' }, { shift: 0, type: 'text', diff --git a/test.js b/test.js index f2c7fc2..42aea1b 100644 --- a/test.js +++ b/test.js @@ -223,5 +223,11 @@ describe('markdown-it-attrs', () => { expected += '\n'; assert.equal(md.render(src), expected); }); + + it('should support images', () => { + src = '![alt](img.png){.a}'; + expected = '

alt

\n'; + assert.equal(md.render(src), expected); + }); });