Skip to content

Commit

Permalink
0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arve0 committed Oct 14, 2016
1 parent c65ed9f commit ce98279
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions markdown-it-attrs.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,27 @@ function firstTokenNotHidden(tokens, i) {
}

/**
* Find first bullet list open.
* Find corresponding bullet/ordered list open.
*/
function bulletListOpen(tokens, i) {
if (tokens[i] &&
tokens[i].type !== 'bullet_list_open' &&
tokens[i].type !== 'ordered_list_open') {
return bulletListOpen(tokens, i - 1);
var level = 0;
var token;
for (; i >= 0; i -= 1) {
token = tokens[i];
// jump past nested lists, level == 0 and open -> correct opening token
if (token.type === 'bullet_list_close' ||
token.type === 'ordered_list_close') {
level += 1;
}
if (token.type === 'bullet_list_open' ||
token.type === 'ordered_list_open') {
if (level === 0) {
return token;
} else {
level -= 1;
}
}
}
return tokens[i];
}

/**
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.4",
"version": "0.8.0",
"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 ce98279

Please sign in to comment.