Skip to content

Commit ad79f52

Browse files
committed
4.1.4
1 parent 0c7be92 commit ad79f52

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

markdown-it-attrs.browser.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ function test(tokens, i, t) {
8181
return res;
8282
}
8383

84-
var _loop2 = function _loop2(key) {
84+
var _loop2 = function _loop2() {
85+
var key = _Object$keys[_i];
86+
8587
if (key === 'shift' || key === 'position') {
8688
return "continue";
8789
}
@@ -198,8 +200,8 @@ function test(tokens, i, t) {
198200
}
199201
};
200202

201-
for (var key in t) {
202-
var _ret = _loop2(key);
203+
for (var _i = 0, _Object$keys = Object.keys(t); _i < _Object$keys.length; _i++) {
204+
var _ret = _loop2();
203205

204206
if (_ret === "continue") continue;
205207
if (_typeof(_ret) === "object") return _ret.v;
@@ -564,14 +566,14 @@ function last(arr) {
564566
}
565567

566568
},{"./utils.js":3}],3:[function(require,module,exports){
567-
'use strict';
569+
"use strict";
570+
568571
/**
569572
* parse {.class #id key=val} strings
570573
* @param {string} str: string to parse
571574
* @param {int} start: where to start parsing (including {)
572575
* @returns {2d array}: [['key', 'val'], ['class', 'red']]
573576
*/
574-
575577
exports.getAttrs = function (str, start, options) {
576578
// not tab, line feed, form feed, space, solidus, greater than sign, quotation mark, apostrophe and equals sign
577579
var allowedKeyChars = /[^\t\n\f />"'=]/;
@@ -673,9 +675,9 @@ exports.getAttrs = function (str, start, options) {
673675

674676
return allowedAttributes.some(isAllowedAttribute);
675677
});
676-
} else {
677-
return attrs;
678678
}
679+
680+
return attrs;
679681
};
680682
/**
681683
* add attributes from [['key', 'val']] list
@@ -704,18 +706,17 @@ exports.addAttrs = function (attrs, token) {
704706
* Does string have properly formatted curly?
705707
*
706708
* start: '{.a} asdf'
707-
* middle: 'a{.b}c'
708709
* end: 'asdf {.a}'
709710
* only: '{.a}'
710711
*
711-
* @param {string} where to expect {} curly. start, middle, end or only.
712+
* @param {string} where to expect {} curly. start, end or only.
712713
* @return {function(string)} Function which testes if string has curly.
713714
*/
714715

715716

716717
exports.hasDelimiters = function (where, options) {
717718
if (!where) {
718-
throw new Error('Parameter `where` not passed. Should be "start", "middle", "end" or "only".');
719+
throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');
719720
}
720721
/**
721722
* @param {string} str
@@ -769,6 +770,9 @@ exports.hasDelimiters = function (where, options) {
769770
slice = str.slice(str.length - options.rightDelimiter.length);
770771
end = slice === options.rightDelimiter ? str.length - options.rightDelimiter.length : -1;
771772
break;
773+
774+
default:
775+
throw new Error("Unexpected case ".concat(where, ", expected 'start', 'end' or 'only'"));
772776
}
773777

774778
return start !== -1 && end !== -1 && validCurlyLength(str.substring(start, end + options.rightDelimiter.length));
@@ -822,6 +826,8 @@ exports.getMatchingOpeningToken = function (tokens, i) {
822826
return tokens[i];
823827
}
824828
}
829+
830+
return false;
825831
};
826832
/**
827833
* from https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markdown-it-attrs",
3-
"version": "4.1.3",
3+
"version": "4.1.4",
44
"description": "Add classes, identifiers and attributes to your markdown with {} curly brackets, similar to pandoc's header attributes",
55
"main": "index.js",
66
"license": "MIT",

0 commit comments

Comments
 (0)