Skip to content

Commit

Permalink
0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arve0 committed Sep 22, 2016
1 parent 55d0f58 commit bfa24b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions markdown-it-attrs.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ module.exports = function attributes(md) {
}

// attributes for blocks
var lastInlineToken;
if (hasCurly(tokens[i].content)) {
var content = last(inlineTokens).content;
lastInlineToken = last(inlineTokens);
var content = lastInlineToken.content;
var curlyStart = content.lastIndexOf('{');
var attrs = utils.getAttrs(content, curlyStart + 1, content.length - 1);
// if list and `\n{#c}` -> apply to bullet list open:
Expand Down Expand Up @@ -127,7 +129,11 @@ module.exports = function attributes(md) {
}
} else {
utils.addAttrs(attrs, correspondingBlock);
last(inlineTokens).content = removeCurly(content);
lastInlineToken.content = removeCurly(content);
if (lastInlineToken.content === '') {
// remove empty inline token
inlineTokens.pop();
}
tokens[i].content = removeCurly(tokens[i].content);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markdown-it-attrs",
"version": "0.7.0",
"version": "0.7.1",
"description": "Add classes, identifiers and attributes to your markdown with {} curly brackets, similar to pandoc's header attributes",
"main": "index.js",
"license": "MIT",
Expand Down

0 comments on commit bfa24b9

Please sign in to comment.