Skip to content

Commit

Permalink
fix inline images, fixes #46 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
arve0 authored Aug 27, 2017
1 parent 8ec8196 commit 84d3f92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@ 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,
type: 'inline',
children: [
{
shift: -1,
type: 'code_inline' // does not have nesting: -1
type: (str) => str === 'image' || str === 'code_inline'
}, {
shift: 0,
type: 'text',
Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,11 @@ describe('markdown-it-attrs', () => {
expected += '</ul>\n';
assert.equal(md.render(src), expected);
});

it('should support images', () => {
src = '![alt](img.png){.a}';
expected = '<p><img src="img.png" alt="alt" class="a"></p>\n';
assert.equal(md.render(src), expected);
});
});

0 comments on commit 84d3f92

Please sign in to comment.