mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Refactor micromark token handling to remove optional Token.htmlFlowChildren property and make related code more efficient for a ~6% elapsed time reduction.
This commit is contained in:
parent
e282874fe3
commit
24c97a54fb
16 changed files with 274 additions and 283 deletions
|
@ -1150,9 +1150,24 @@ var flatTokensSymbol = Symbol("flat-tokens");
|
||||||
* @property {number} endColumn End column (1-based).
|
* @property {number} endColumn End column (1-based).
|
||||||
* @property {string} text Token text.
|
* @property {string} text Token text.
|
||||||
* @property {Token[]} children Child tokens.
|
* @property {Token[]} children Child tokens.
|
||||||
* @property {Token[]} [htmlFlowChildren] Child tokens for htmlFlow.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a token is an htmlFlow type containing an HTML comment.
|
||||||
|
*
|
||||||
|
* @param {Token} token Micromark token.
|
||||||
|
* @returns {boolean} True iff token is htmlFlow containing a comment.
|
||||||
|
*/
|
||||||
|
function isHtmlFlowComment(token) {
|
||||||
|
var text = token.text,
|
||||||
|
type = token.type;
|
||||||
|
if (type === "htmlFlow" && text.startsWith("<!--") && text.endsWith("-->")) {
|
||||||
|
var comment = text.slice(4, -3);
|
||||||
|
return !comment.startsWith(">") && !comment.startsWith("->") && !comment.endsWith("-") && !comment.includes("--");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a Markdown document and returns Micromark events.
|
* Parses a Markdown document and returns Micromark events.
|
||||||
*
|
*
|
||||||
|
@ -1205,6 +1220,7 @@ function micromarkParseWithOffset(markdown, micromarkOptions, referencesDefined,
|
||||||
var history = [current];
|
var history = [current];
|
||||||
var reparseOptions = null;
|
var reparseOptions = null;
|
||||||
var lines = null;
|
var lines = null;
|
||||||
|
var skipHtmlFlowChildren = false;
|
||||||
var _iterator = _createForOfIteratorHelper(events),
|
var _iterator = _createForOfIteratorHelper(events),
|
||||||
_step;
|
_step;
|
||||||
try {
|
try {
|
||||||
|
@ -1222,7 +1238,7 @@ function micromarkParseWithOffset(markdown, micromarkOptions, referencesDefined,
|
||||||
var endColumn = end["column"],
|
var endColumn = end["column"],
|
||||||
endLine = end["line"];
|
endLine = end["line"];
|
||||||
var text = context.sliceSerialize(token);
|
var text = context.sliceSerialize(token);
|
||||||
if (kind === "enter") {
|
if (kind === "enter" && !skipHtmlFlowChildren) {
|
||||||
var previous = current;
|
var previous = current;
|
||||||
history.push(previous);
|
history.push(previous);
|
||||||
current = {
|
current = {
|
||||||
|
@ -1234,7 +1250,11 @@ function micromarkParseWithOffset(markdown, micromarkOptions, referencesDefined,
|
||||||
text: text,
|
text: text,
|
||||||
"children": []
|
"children": []
|
||||||
};
|
};
|
||||||
if (current.type === "htmlFlow") {
|
previous.children.push(current);
|
||||||
|
flatTokens.push(current);
|
||||||
|
// @ts-ignore
|
||||||
|
if (current.type === "htmlFlow" && !isHtmlFlowComment(current)) {
|
||||||
|
skipHtmlFlowChildren = true;
|
||||||
if (!reparseOptions || !lines) {
|
if (!reparseOptions || !lines) {
|
||||||
reparseOptions = _objectSpread(_objectSpread({}, micromarkOptions), {}, {
|
reparseOptions = _objectSpread(_objectSpread({}, micromarkOptions), {}, {
|
||||||
"extensions": [{
|
"extensions": [{
|
||||||
|
@ -1246,17 +1266,22 @@ function micromarkParseWithOffset(markdown, micromarkOptions, referencesDefined,
|
||||||
lines = markdown.split(newLineRe);
|
lines = markdown.split(newLineRe);
|
||||||
}
|
}
|
||||||
var reparseMarkdown = lines.slice(current.startLine - 1, current.endLine).join("\n");
|
var reparseMarkdown = lines.slice(current.startLine - 1, current.endLine).join("\n");
|
||||||
current.htmlFlowChildren = micromarkParseWithOffset(reparseMarkdown, reparseOptions, referencesDefined, current.startLine - 1);
|
var tokens = micromarkParseWithOffset(reparseMarkdown, reparseOptions, referencesDefined, current.startLine - 1);
|
||||||
|
current.children = tokens;
|
||||||
|
flatTokens.push.apply(flatTokens, _toConsumableArray(tokens[flatTokensSymbol]));
|
||||||
}
|
}
|
||||||
previous.children.push(current);
|
|
||||||
flatTokens.push(current);
|
|
||||||
} else if (kind === "exit") {
|
} else if (kind === "exit") {
|
||||||
|
if (type === "htmlFlow") {
|
||||||
|
skipHtmlFlowChildren = false;
|
||||||
|
}
|
||||||
|
if (!skipHtmlFlowChildren) {
|
||||||
Object.freeze(current.children);
|
Object.freeze(current.children);
|
||||||
Object.freeze(current);
|
Object.freeze(current);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
current = history.pop();
|
current = history.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return document
|
// Return document
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1327,20 +1352,6 @@ function filterByTypes(tokens, allowed) {
|
||||||
return filterByPredicate(tokens, predicate);
|
return filterByPredicate(tokens, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter a list of Micromark tokens for HTML tokens.
|
|
||||||
*
|
|
||||||
* @param {Token[]} tokens Micromark tokens.
|
|
||||||
* @returns {Token[]} Filtered tokens.
|
|
||||||
*/
|
|
||||||
function filterByHtmlTokens(tokens) {
|
|
||||||
return filterByPredicate(tokens, function (token) {
|
|
||||||
return token.type === "htmlText";
|
|
||||||
}, function (token) {
|
|
||||||
return token.htmlFlowChildren || token.children;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the heading level of a Micromark heading tokan.
|
* Gets the heading level of a Micromark heading tokan.
|
||||||
*
|
*
|
||||||
|
@ -1432,7 +1443,6 @@ function tokenIfType(token, type) {
|
||||||
}
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"parse": micromarkParse,
|
"parse": micromarkParse,
|
||||||
filterByHtmlTokens: filterByHtmlTokens,
|
|
||||||
filterByPredicate: filterByPredicate,
|
filterByPredicate: filterByPredicate,
|
||||||
filterByTypes: filterByTypes,
|
filterByTypes: filterByTypes,
|
||||||
getHeadingLevel: getHeadingLevel,
|
getHeadingLevel: getHeadingLevel,
|
||||||
|
@ -4836,7 +4846,7 @@ module.exports = {
|
||||||
|
|
||||||
// For every top-level list...
|
// For every top-level list...
|
||||||
var topLevelLists = filterByPredicate(parsers.micromark.tokens, isList, function (token) {
|
var topLevelLists = filterByPredicate(parsers.micromark.tokens, isList, function (token) {
|
||||||
return isList(token) ? [] : token.children;
|
return isList(token) || token.type === "htmlFlow" ? [] : token.children;
|
||||||
});
|
});
|
||||||
var _iterator = _createForOfIteratorHelper(topLevelLists),
|
var _iterator = _createForOfIteratorHelper(topLevelLists),
|
||||||
_step;
|
_step;
|
||||||
|
@ -4903,7 +4913,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
||||||
var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
||||||
addError = _require.addError;
|
addError = _require.addError;
|
||||||
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
||||||
filterByHtmlTokens = _require2.filterByHtmlTokens,
|
filterByTypes = _require2.filterByTypes,
|
||||||
getHtmlTagInfo = _require2.getHtmlTagInfo;
|
getHtmlTagInfo = _require2.getHtmlTagInfo;
|
||||||
var nextLinesRe = /[\r\n][\s\S]*$/;
|
var nextLinesRe = /[\r\n][\s\S]*$/;
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -4916,7 +4926,8 @@ module.exports = {
|
||||||
allowedElements = allowedElements.map(function (element) {
|
allowedElements = allowedElements.map(function (element) {
|
||||||
return element.toLowerCase();
|
return element.toLowerCase();
|
||||||
});
|
});
|
||||||
var _iterator = _createForOfIteratorHelper(filterByHtmlTokens(params.parsers.micromark.tokens)),
|
var tokens = params.parsers.micromark.tokens;
|
||||||
|
var _iterator = _createForOfIteratorHelper(filterByTypes(tokens, ["htmlText"])),
|
||||||
_step;
|
_step;
|
||||||
try {
|
try {
|
||||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||||
|
@ -5159,14 +5170,12 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
|
||||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
||||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
||||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
||||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
||||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
||||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||||
var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
||||||
addError = _require.addError;
|
addError = _require.addError;
|
||||||
|
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
||||||
|
filterByPredicate = _require2.filterByPredicate;
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"names": ["MD037", "no-space-in-emphasis"],
|
"names": ["MD037", "no-space-in-emphasis"],
|
||||||
"description": "Spaces inside emphasis markers",
|
"description": "Spaces inside emphasis markers",
|
||||||
|
@ -5180,34 +5189,34 @@ module.exports = {
|
||||||
var marker = _arr[_i];
|
var marker = _arr[_i];
|
||||||
emphasisTokensByMarker.set(marker, []);
|
emphasisTokensByMarker.set(marker, []);
|
||||||
}
|
}
|
||||||
var pending = _toConsumableArray(parsers.micromark.tokens);
|
var tokens = filterByPredicate(parsers.micromark.tokens, function (token) {
|
||||||
var token = null;
|
return token.children.some(function (child) {
|
||||||
while (token = pending.shift()) {
|
return child.type === "data";
|
||||||
// Use reparsed children of htmlFlow tokens
|
});
|
||||||
if (token.type === "htmlFlow") {
|
});
|
||||||
pending.unshift.apply(pending, _toConsumableArray(token.htmlFlowChildren));
|
var _iterator = _createForOfIteratorHelper(tokens),
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pending.push.apply(pending, _toConsumableArray(token.children));
|
|
||||||
|
|
||||||
// Build lists of bare tokens for each emphasis marker type
|
|
||||||
var _iterator = _createForOfIteratorHelper(emphasisTokensByMarker.values()),
|
|
||||||
_step;
|
_step;
|
||||||
try {
|
try {
|
||||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||||
var emphasisTokens = _step.value;
|
var token = _step.value;
|
||||||
emphasisTokens.length = 0;
|
// Build lists of bare tokens for each emphasis marker type
|
||||||
}
|
var _iterator2 = _createForOfIteratorHelper(emphasisTokensByMarker.values()),
|
||||||
} catch (err) {
|
|
||||||
_iterator.e(err);
|
|
||||||
} finally {
|
|
||||||
_iterator.f();
|
|
||||||
}
|
|
||||||
var _iterator2 = _createForOfIteratorHelper(token.children),
|
|
||||||
_step2;
|
_step2;
|
||||||
try {
|
try {
|
||||||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
||||||
var child = _step2.value;
|
var emphasisTokens = _step2.value;
|
||||||
|
emphasisTokens.length = 0;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
_iterator2.e(err);
|
||||||
|
} finally {
|
||||||
|
_iterator2.f();
|
||||||
|
}
|
||||||
|
var _iterator3 = _createForOfIteratorHelper(token.children),
|
||||||
|
_step3;
|
||||||
|
try {
|
||||||
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
||||||
|
var child = _step3.value;
|
||||||
var text = child.text,
|
var text = child.text,
|
||||||
type = child.type;
|
type = child.type;
|
||||||
if (type === "data" && text.length <= 3) {
|
if (type === "data" && text.length <= 3) {
|
||||||
|
@ -5220,15 +5229,15 @@ module.exports = {
|
||||||
|
|
||||||
// Process bare tokens for each emphasis marker type
|
// Process bare tokens for each emphasis marker type
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
_iterator2.e(err);
|
_iterator3.e(err);
|
||||||
} finally {
|
} finally {
|
||||||
_iterator2.f();
|
_iterator3.f();
|
||||||
}
|
}
|
||||||
var _iterator3 = _createForOfIteratorHelper(emphasisTokensByMarker.entries()),
|
var _iterator4 = _createForOfIteratorHelper(emphasisTokensByMarker.entries()),
|
||||||
_step3;
|
_step4;
|
||||||
try {
|
try {
|
||||||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
||||||
var entry = _step3.value;
|
var entry = _step4.value;
|
||||||
var _entry = _slicedToArray(entry, 2),
|
var _entry = _slicedToArray(entry, 2),
|
||||||
_marker = _entry[0],
|
_marker = _entry[0],
|
||||||
_emphasisTokens2 = _entry[1];
|
_emphasisTokens2 = _entry[1];
|
||||||
|
@ -5265,11 +5274,16 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
_iterator3.e(err);
|
_iterator4.e(err);
|
||||||
} finally {
|
} finally {
|
||||||
_iterator3.f();
|
_iterator4.f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
_iterator.e(err);
|
||||||
|
} finally {
|
||||||
|
_iterator.f();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5738,26 +5752,19 @@ module.exports = {
|
||||||
var includeCodeBlocks = codeBlocks === undefined ? true : !!codeBlocks;
|
var includeCodeBlocks = codeBlocks === undefined ? true : !!codeBlocks;
|
||||||
var htmlElements = params.config.html_elements;
|
var htmlElements = params.config.html_elements;
|
||||||
var includeHtmlElements = htmlElements === undefined ? true : !!htmlElements;
|
var includeHtmlElements = htmlElements === undefined ? true : !!htmlElements;
|
||||||
var scannedTypes = new Set(["data", "htmlFlowData"]);
|
var scannedTypes = new Set(["data"]);
|
||||||
if (includeCodeBlocks) {
|
if (includeCodeBlocks) {
|
||||||
scannedTypes.add("codeFlowValue");
|
scannedTypes.add("codeFlowValue");
|
||||||
scannedTypes.add("codeTextData");
|
scannedTypes.add("codeTextData");
|
||||||
}
|
}
|
||||||
|
if (includeHtmlElements) {
|
||||||
|
scannedTypes.add("htmlFlowData");
|
||||||
|
scannedTypes.add("htmlTextData");
|
||||||
|
}
|
||||||
var contentTokens = filterByPredicate(params.parsers.micromark.tokens, function (token) {
|
var contentTokens = filterByPredicate(params.parsers.micromark.tokens, function (token) {
|
||||||
return scannedTypes.has(token.type);
|
return scannedTypes.has(token.type);
|
||||||
}, function (token) {
|
}, function (token) {
|
||||||
var children = token.children;
|
return token.children.filter(function (t) {
|
||||||
var htmlFlowChildren = token.htmlFlowChildren,
|
|
||||||
text = token.text,
|
|
||||||
type = token.type;
|
|
||||||
if (!includeHtmlElements && type === "htmlFlow") {
|
|
||||||
children = text.startsWith("<!--") ?
|
|
||||||
// Remove comment content
|
|
||||||
[] :
|
|
||||||
// Examine htmlText content
|
|
||||||
htmlFlowChildren;
|
|
||||||
}
|
|
||||||
return children.filter(function (t) {
|
|
||||||
return !ignoredChildTypes.has(t.type);
|
return !ignoredChildTypes.has(t.type);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -6027,14 +6034,18 @@ var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
||||||
addError = _require.addError,
|
addError = _require.addError,
|
||||||
emphasisOrStrongStyleFor = _require.emphasisOrStrongStyleFor;
|
emphasisOrStrongStyleFor = _require.emphasisOrStrongStyleFor;
|
||||||
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
||||||
filterByTypes = _require2.filterByTypes,
|
filterByPredicate = _require2.filterByPredicate,
|
||||||
tokenIfType = _require2.tokenIfType;
|
tokenIfType = _require2.tokenIfType;
|
||||||
var intrawordRe = /\w/;
|
var intrawordRe = /\w/;
|
||||||
var impl = function impl(params, onError, type, asterisk, underline) {
|
var impl = function impl(params, onError, type, asterisk, underline) {
|
||||||
var style = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "consistent";
|
var style = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "consistent";
|
||||||
var lines = params.lines,
|
var lines = params.lines,
|
||||||
parsers = params.parsers;
|
parsers = params.parsers;
|
||||||
var emphasisTokens = filterByTypes(parsers.micromark.tokens, [type]);
|
var emphasisTokens = filterByPredicate(parsers.micromark.tokens, function (token) {
|
||||||
|
return token.type === type;
|
||||||
|
}, function (token) {
|
||||||
|
return token.type === "htmlFlow" ? [] : token.children;
|
||||||
|
});
|
||||||
var _iterator = _createForOfIteratorHelper(emphasisTokens),
|
var _iterator = _createForOfIteratorHelper(emphasisTokens),
|
||||||
_step;
|
_step;
|
||||||
try {
|
try {
|
||||||
|
@ -6114,7 +6125,6 @@ var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"),
|
||||||
addError = _require.addError,
|
addError = _require.addError,
|
||||||
addErrorDetailIf = _require.addErrorDetailIf;
|
addErrorDetailIf = _require.addErrorDetailIf;
|
||||||
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"),
|
||||||
filterByHtmlTokens = _require2.filterByHtmlTokens,
|
|
||||||
filterByTypes = _require2.filterByTypes,
|
filterByTypes = _require2.filterByTypes,
|
||||||
getHtmlTagInfo = _require2.getHtmlTagInfo;
|
getHtmlTagInfo = _require2.getHtmlTagInfo;
|
||||||
|
|
||||||
|
@ -6179,7 +6189,7 @@ module.exports = {
|
||||||
} finally {
|
} finally {
|
||||||
_iterator.f();
|
_iterator.f();
|
||||||
}
|
}
|
||||||
var _iterator2 = _createForOfIteratorHelper(filterByHtmlTokens(tokens)),
|
var _iterator2 = _createForOfIteratorHelper(filterByTypes(tokens, ["htmlText"])),
|
||||||
_step2;
|
_step2;
|
||||||
try {
|
try {
|
||||||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
||||||
|
|
|
@ -23,9 +23,32 @@ const flatTokensSymbol = Symbol("flat-tokens");
|
||||||
* @property {number} endColumn End column (1-based).
|
* @property {number} endColumn End column (1-based).
|
||||||
* @property {string} text Token text.
|
* @property {string} text Token text.
|
||||||
* @property {Token[]} children Child tokens.
|
* @property {Token[]} children Child tokens.
|
||||||
* @property {Token[]} [htmlFlowChildren] Child tokens for htmlFlow.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a token is an htmlFlow type containing an HTML comment.
|
||||||
|
*
|
||||||
|
* @param {Token} token Micromark token.
|
||||||
|
* @returns {boolean} True iff token is htmlFlow containing a comment.
|
||||||
|
*/
|
||||||
|
function isHtmlFlowComment(token) {
|
||||||
|
const { text, type } = token;
|
||||||
|
if (
|
||||||
|
(type === "htmlFlow") &&
|
||||||
|
text.startsWith("<!--") &&
|
||||||
|
text.endsWith("-->")
|
||||||
|
) {
|
||||||
|
const comment = text.slice(4, -3);
|
||||||
|
return (
|
||||||
|
!comment.startsWith(">") &&
|
||||||
|
!comment.startsWith("->") &&
|
||||||
|
!comment.endsWith("-") &&
|
||||||
|
!comment.includes("--")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a Markdown document and returns Micromark events.
|
* Parses a Markdown document and returns Micromark events.
|
||||||
*
|
*
|
||||||
|
@ -91,13 +114,14 @@ function micromarkParseWithOffset(
|
||||||
const history = [ current ];
|
const history = [ current ];
|
||||||
let reparseOptions = null;
|
let reparseOptions = null;
|
||||||
let lines = null;
|
let lines = null;
|
||||||
|
let skipHtmlFlowChildren = false;
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
const [ kind, token, context ] = event;
|
const [ kind, token, context ] = event;
|
||||||
const { type, start, end } = token;
|
const { type, start, end } = token;
|
||||||
const { "column": startColumn, "line": startLine } = start;
|
const { "column": startColumn, "line": startLine } = start;
|
||||||
const { "column": endColumn, "line": endLine } = end;
|
const { "column": endColumn, "line": endLine } = end;
|
||||||
const text = context.sliceSerialize(token);
|
const text = context.sliceSerialize(token);
|
||||||
if (kind === "enter") {
|
if ((kind === "enter") && !skipHtmlFlowChildren) {
|
||||||
const previous = current;
|
const previous = current;
|
||||||
history.push(previous);
|
history.push(previous);
|
||||||
current = {
|
current = {
|
||||||
|
@ -109,7 +133,11 @@ function micromarkParseWithOffset(
|
||||||
text,
|
text,
|
||||||
"children": []
|
"children": []
|
||||||
};
|
};
|
||||||
if (current.type === "htmlFlow") {
|
previous.children.push(current);
|
||||||
|
flatTokens.push(current);
|
||||||
|
// @ts-ignore
|
||||||
|
if ((current.type === "htmlFlow") && !isHtmlFlowComment(current)) {
|
||||||
|
skipHtmlFlowChildren = true;
|
||||||
if (!reparseOptions || !lines) {
|
if (!reparseOptions || !lines) {
|
||||||
reparseOptions = {
|
reparseOptions = {
|
||||||
...micromarkOptions,
|
...micromarkOptions,
|
||||||
|
@ -126,22 +154,27 @@ function micromarkParseWithOffset(
|
||||||
const reparseMarkdown = lines
|
const reparseMarkdown = lines
|
||||||
.slice(current.startLine - 1, current.endLine)
|
.slice(current.startLine - 1, current.endLine)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
current.htmlFlowChildren = micromarkParseWithOffset(
|
const tokens = micromarkParseWithOffset(
|
||||||
reparseMarkdown,
|
reparseMarkdown,
|
||||||
reparseOptions,
|
reparseOptions,
|
||||||
referencesDefined,
|
referencesDefined,
|
||||||
current.startLine - 1
|
current.startLine - 1
|
||||||
);
|
);
|
||||||
|
current.children = tokens;
|
||||||
|
flatTokens.push(...tokens[flatTokensSymbol]);
|
||||||
}
|
}
|
||||||
previous.children.push(current);
|
|
||||||
flatTokens.push(current);
|
|
||||||
} else if (kind === "exit") {
|
} else if (kind === "exit") {
|
||||||
|
if (type === "htmlFlow") {
|
||||||
|
skipHtmlFlowChildren = false;
|
||||||
|
}
|
||||||
|
if (!skipHtmlFlowChildren) {
|
||||||
Object.freeze(current.children);
|
Object.freeze(current.children);
|
||||||
Object.freeze(current);
|
Object.freeze(current);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
current = history.pop();
|
current = history.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return document
|
// Return document
|
||||||
Object.defineProperty(document, flatTokensSymbol, { "value": flatTokens });
|
Object.defineProperty(document, flatTokensSymbol, { "value": flatTokens });
|
||||||
|
@ -211,20 +244,6 @@ function filterByTypes(tokens, allowed) {
|
||||||
return filterByPredicate(tokens, predicate);
|
return filterByPredicate(tokens, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter a list of Micromark tokens for HTML tokens.
|
|
||||||
*
|
|
||||||
* @param {Token[]} tokens Micromark tokens.
|
|
||||||
* @returns {Token[]} Filtered tokens.
|
|
||||||
*/
|
|
||||||
function filterByHtmlTokens(tokens) {
|
|
||||||
return filterByPredicate(
|
|
||||||
tokens,
|
|
||||||
(token) => token.type === "htmlText",
|
|
||||||
(token) => token.htmlFlowChildren || token.children
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the heading level of a Micromark heading tokan.
|
* Gets the heading level of a Micromark heading tokan.
|
||||||
*
|
*
|
||||||
|
@ -318,7 +337,6 @@ function tokenIfType(token, type) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"parse": micromarkParse,
|
"parse": micromarkParse,
|
||||||
filterByHtmlTokens,
|
|
||||||
filterByPredicate,
|
filterByPredicate,
|
||||||
filterByTypes,
|
filterByTypes,
|
||||||
getHeadingLevel,
|
getHeadingLevel,
|
||||||
|
|
|
@ -46,7 +46,9 @@ module.exports = {
|
||||||
const topLevelLists = filterByPredicate(
|
const topLevelLists = filterByPredicate(
|
||||||
parsers.micromark.tokens,
|
parsers.micromark.tokens,
|
||||||
isList,
|
isList,
|
||||||
(token) => (isList(token) ? [] : token.children)
|
(token) => (
|
||||||
|
(isList(token) || (token.type === "htmlFlow")) ? [] : token.children
|
||||||
|
)
|
||||||
);
|
);
|
||||||
for (const list of topLevelLists) {
|
for (const list of topLevelLists) {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { addError } = require("../helpers");
|
const { addError } = require("../helpers");
|
||||||
const { filterByHtmlTokens, getHtmlTagInfo } =
|
const { filterByTypes, getHtmlTagInfo } =
|
||||||
require("../helpers/micromark.cjs");
|
require("../helpers/micromark.cjs");
|
||||||
|
|
||||||
const nextLinesRe = /[\r\n][\s\S]*$/;
|
const nextLinesRe = /[\r\n][\s\S]*$/;
|
||||||
|
@ -16,7 +16,8 @@ module.exports = {
|
||||||
let allowedElements = params.config.allowed_elements;
|
let allowedElements = params.config.allowed_elements;
|
||||||
allowedElements = Array.isArray(allowedElements) ? allowedElements : [];
|
allowedElements = Array.isArray(allowedElements) ? allowedElements : [];
|
||||||
allowedElements = allowedElements.map((element) => element.toLowerCase());
|
allowedElements = allowedElements.map((element) => element.toLowerCase());
|
||||||
for (const token of filterByHtmlTokens(params.parsers.micromark.tokens)) {
|
const { tokens } = params.parsers.micromark;
|
||||||
|
for (const token of filterByTypes(tokens, [ "htmlText" ])) {
|
||||||
const htmlTagInfo = getHtmlTagInfo(token);
|
const htmlTagInfo = getHtmlTagInfo(token);
|
||||||
if (
|
if (
|
||||||
htmlTagInfo &&
|
htmlTagInfo &&
|
||||||
|
|
16
lib/md037.js
16
lib/md037.js
|
@ -3,6 +3,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { addError } = require("../helpers");
|
const { addError } = require("../helpers");
|
||||||
|
const { filterByPredicate } = require("../helpers/micromark.cjs");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"names": [ "MD037", "no-space-in-emphasis" ],
|
"names": [ "MD037", "no-space-in-emphasis" ],
|
||||||
|
@ -16,16 +17,11 @@ module.exports = {
|
||||||
for (const marker of [ "_", "__", "___", "*", "**", "***" ]) {
|
for (const marker of [ "_", "__", "___", "*", "**", "***" ]) {
|
||||||
emphasisTokensByMarker.set(marker, []);
|
emphasisTokensByMarker.set(marker, []);
|
||||||
}
|
}
|
||||||
const pending = [ ...parsers.micromark.tokens ];
|
const tokens = filterByPredicate(
|
||||||
let token = null;
|
parsers.micromark.tokens,
|
||||||
while ((token = pending.shift())) {
|
(token) => token.children.some((child) => child.type === "data")
|
||||||
|
);
|
||||||
// Use reparsed children of htmlFlow tokens
|
for (const token of tokens) {
|
||||||
if (token.type === "htmlFlow") {
|
|
||||||
pending.unshift(...token.htmlFlowChildren);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pending.push(...token.children);
|
|
||||||
|
|
||||||
// Build lists of bare tokens for each emphasis marker type
|
// Build lists of bare tokens for each emphasis marker type
|
||||||
for (const emphasisTokens of emphasisTokensByMarker.values()) {
|
for (const emphasisTokens of emphasisTokensByMarker.values()) {
|
||||||
|
|
21
lib/md044.js
21
lib/md044.js
|
@ -29,27 +29,22 @@ module.exports = {
|
||||||
const htmlElements = params.config.html_elements;
|
const htmlElements = params.config.html_elements;
|
||||||
const includeHtmlElements =
|
const includeHtmlElements =
|
||||||
(htmlElements === undefined) ? true : !!htmlElements;
|
(htmlElements === undefined) ? true : !!htmlElements;
|
||||||
const scannedTypes = new Set([ "data", "htmlFlowData" ]);
|
const scannedTypes = new Set([ "data" ]);
|
||||||
if (includeCodeBlocks) {
|
if (includeCodeBlocks) {
|
||||||
scannedTypes.add("codeFlowValue");
|
scannedTypes.add("codeFlowValue");
|
||||||
scannedTypes.add("codeTextData");
|
scannedTypes.add("codeTextData");
|
||||||
}
|
}
|
||||||
|
if (includeHtmlElements) {
|
||||||
|
scannedTypes.add("htmlFlowData");
|
||||||
|
scannedTypes.add("htmlTextData");
|
||||||
|
}
|
||||||
const contentTokens =
|
const contentTokens =
|
||||||
filterByPredicate(
|
filterByPredicate(
|
||||||
params.parsers.micromark.tokens,
|
params.parsers.micromark.tokens,
|
||||||
(token) => scannedTypes.has(token.type),
|
(token) => scannedTypes.has(token.type),
|
||||||
(token) => {
|
(token) => (
|
||||||
let { children } = token;
|
token.children.filter((t) => !ignoredChildTypes.has(t.type))
|
||||||
const { htmlFlowChildren, text, type } = token;
|
)
|
||||||
if (!includeHtmlElements && (type === "htmlFlow")) {
|
|
||||||
children = text.startsWith("<!--") ?
|
|
||||||
// Remove comment content
|
|
||||||
[] :
|
|
||||||
// Examine htmlText content
|
|
||||||
htmlFlowChildren;
|
|
||||||
}
|
|
||||||
return children.filter((t) => !ignoredChildTypes.has(t.type));
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
const exclusions = [];
|
const exclusions = [];
|
||||||
const autoLinked = new Set();
|
const autoLinked = new Set();
|
||||||
|
|
|
@ -3,15 +3,18 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { addError, emphasisOrStrongStyleFor } = require("../helpers");
|
const { addError, emphasisOrStrongStyleFor } = require("../helpers");
|
||||||
const { filterByTypes, tokenIfType } = require("../helpers/micromark.cjs");
|
const { filterByPredicate, tokenIfType } = require("../helpers/micromark.cjs");
|
||||||
|
|
||||||
const intrawordRe = /\w/;
|
const intrawordRe = /\w/;
|
||||||
|
|
||||||
const impl =
|
const impl =
|
||||||
(params, onError, type, asterisk, underline, style = "consistent") => {
|
(params, onError, type, asterisk, underline, style = "consistent") => {
|
||||||
const { lines, parsers } = params;
|
const { lines, parsers } = params;
|
||||||
const emphasisTokens =
|
const emphasisTokens = filterByPredicate(
|
||||||
filterByTypes(parsers.micromark.tokens, [ type ]);
|
parsers.micromark.tokens,
|
||||||
|
(token) => token.type === type,
|
||||||
|
(token) => ((token.type === "htmlFlow") ? [] : token.children)
|
||||||
|
);
|
||||||
for (const token of emphasisTokens) {
|
for (const token of emphasisTokens) {
|
||||||
const { children } = token;
|
const { children } = token;
|
||||||
const childType = `${type}Sequence`;
|
const childType = `${type}Sequence`;
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { addError, addErrorDetailIf } = require("../helpers");
|
const { addError, addErrorDetailIf } = require("../helpers");
|
||||||
const { filterByHtmlTokens, filterByTypes, getHtmlTagInfo } =
|
const { filterByTypes, getHtmlTagInfo } = require("../helpers/micromark.cjs");
|
||||||
require("../helpers/micromark.cjs");
|
|
||||||
|
|
||||||
// Regular expression for identifying HTML anchor names
|
// Regular expression for identifying HTML anchor names
|
||||||
const idRe = /\sid\s*=\s*['"]?([^'"\s>]+)/iu;
|
const idRe = /\sid\s*=\s*['"]?([^'"\s>]+)/iu;
|
||||||
|
@ -68,7 +67,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process HTML anchors
|
// Process HTML anchors
|
||||||
for (const token of filterByHtmlTokens(tokens)) {
|
for (const token of filterByTypes(tokens, [ "htmlText" ])) {
|
||||||
const htmlTagInfo = getHtmlTagInfo(token);
|
const htmlTagInfo = getHtmlTagInfo(token);
|
||||||
if (htmlTagInfo && !htmlTagInfo.close) {
|
if (htmlTagInfo && !htmlTagInfo.close) {
|
||||||
const anchorMatch = idRe.exec(token.text) ||
|
const anchorMatch = idRe.exec(token.text) ||
|
||||||
|
|
|
@ -19,3 +19,11 @@ also` __bad__ {MD050}
|
||||||
This `is
|
This `is
|
||||||
also
|
also
|
||||||
very` __bad__ {MD050}
|
very` __bad__ {MD050}
|
||||||
|
|
||||||
|
<p>HTML __should__ *be* ignored</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
HTML __should__ *be* ignored
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- markdownlint-configure-file { "no-inline-html": false } -->
|
||||||
|
|
|
@ -74,7 +74,22 @@ code
|
||||||
|
|
||||||
text
|
text
|
||||||
|
|
||||||
|
<p>
|
||||||
|
1. Not a
|
||||||
|
2. list
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>1. Not a list</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
* Not a
|
||||||
|
* list
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>* Not a list</p>
|
||||||
|
|
||||||
<!-- markdownlint-configure-file {
|
<!-- markdownlint-configure-file {
|
||||||
|
"no-inline-html": false,
|
||||||
"ul-style": false,
|
"ul-style": false,
|
||||||
"ol-prefix": false,
|
"ol-prefix": false,
|
||||||
"fenced-code-language": false
|
"fenced-code-language": false
|
||||||
|
|
|
@ -26,17 +26,28 @@ test("getMicromarkEvents/filterByPredicate", async(t) => {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
const content = await testContent;
|
const content = await testContent;
|
||||||
const events = getMicromarkEvents(content);
|
const events = getMicromarkEvents(content);
|
||||||
|
let inHtmlFlow = false;
|
||||||
const eventTypes = events
|
const eventTypes = events
|
||||||
.filter((event) => event[0] === "enter")
|
.filter((event) => {
|
||||||
|
const result = !inHtmlFlow && (event[0] === "enter");
|
||||||
|
if (event[1].type === "htmlFlow") {
|
||||||
|
inHtmlFlow = !inHtmlFlow;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
.map((event) => event[1].type);
|
.map((event) => event[1].type);
|
||||||
const tokens = parse(content);
|
const tokens = parse(content);
|
||||||
const filtered = filterByPredicate(tokens, () => true);
|
const filtered = filterByPredicate(
|
||||||
|
tokens,
|
||||||
|
() => true,
|
||||||
|
(token) => ((token.type === "htmlFlow") ? [] : token.children)
|
||||||
|
);
|
||||||
const tokenTypes = filtered.map((token) => token.type);
|
const tokenTypes = filtered.map((token) => token.type);
|
||||||
t.deepEqual(tokenTypes, eventTypes);
|
t.deepEqual(tokenTypes, eventTypes);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("filterByTypes", async(t) => {
|
test("filterByTypes", async(t) => {
|
||||||
t.plan(6);
|
t.plan(8);
|
||||||
const filtered = filterByTypes(
|
const filtered = filterByTypes(
|
||||||
await testTokens,
|
await testTokens,
|
||||||
[ "atxHeadingText", "codeText", "htmlText", "setextHeadingText" ]
|
[ "atxHeadingText", "codeText", "htmlText", "setextHeadingText" ]
|
||||||
|
|
|
@ -912,7 +912,7 @@ test("readme", async(t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("validateJsonUsingConfigSchemaStrict", (t) => {
|
test("validateJsonUsingConfigSchemaStrict", (t) => {
|
||||||
t.plan(159);
|
t.plan(160);
|
||||||
const configRe =
|
const configRe =
|
||||||
/^[\s\S]*<!-- markdownlint-configure-file ([\s\S]*) -->[\s\S]*$/;
|
/^[\s\S]*<!-- markdownlint-configure-file ([\s\S]*) -->[\s\S]*$/;
|
||||||
const ignoreFiles = new Set([
|
const ignoreFiles = new Set([
|
||||||
|
|
|
@ -2574,57 +2574,6 @@ Generated by [AVA](https://avajs.dev).
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 4,
|
|
||||||
endLine: 43,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 43,
|
|
||||||
text: '<p>',
|
|
||||||
type: 'htmlFlowData',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 1,
|
|
||||||
endLine: 44,
|
|
||||||
startColumn: 4,
|
|
||||||
startLine: 43,
|
|
||||||
text: `␊
|
|
||||||
`,
|
|
||||||
type: 'lineEnding',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 11,
|
|
||||||
endLine: 44,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 44,
|
|
||||||
text: 'HTML block',
|
|
||||||
type: 'htmlFlowData',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 1,
|
|
||||||
endLine: 45,
|
|
||||||
startColumn: 11,
|
|
||||||
startLine: 44,
|
|
||||||
text: `␊
|
|
||||||
`,
|
|
||||||
type: 'lineEnding',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 5,
|
|
||||||
endLine: 45,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 45,
|
|
||||||
text: '</p>',
|
|
||||||
type: 'htmlFlowData',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
endColumn: 5,
|
|
||||||
endLine: 45,
|
|
||||||
htmlFlowChildren: [
|
|
||||||
{
|
{
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -2717,6 +2666,8 @@ Generated by [AVA](https://avajs.dev).
|
||||||
type: 'content',
|
type: 'content',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
endColumn: 5,
|
||||||
|
endLine: 45,
|
||||||
startColumn: 1,
|
startColumn: 1,
|
||||||
startLine: 43,
|
startLine: 43,
|
||||||
text: `<p>␊
|
text: `<p>␊
|
||||||
|
@ -3224,47 +3175,6 @@ Generated by [AVA](https://avajs.dev).
|
||||||
],
|
],
|
||||||
endColumn: 35,
|
endColumn: 35,
|
||||||
endLine: 51,
|
endLine: 51,
|
||||||
htmlFlowChildren: [
|
|
||||||
{
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
children: [],
|
|
||||||
endColumn: 35,
|
|
||||||
endLine: 51,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 51,
|
|
||||||
text: '<!-- markdownlint-disable-file -->',
|
|
||||||
type: 'htmlTextData',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
endColumn: 35,
|
|
||||||
endLine: 51,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 51,
|
|
||||||
text: '<!-- markdownlint-disable-file -->',
|
|
||||||
type: 'htmlText',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
endColumn: 35,
|
|
||||||
endLine: 51,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 51,
|
|
||||||
text: '<!-- markdownlint-disable-file -->',
|
|
||||||
type: 'paragraph',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
endColumn: 35,
|
|
||||||
endLine: 51,
|
|
||||||
startColumn: 1,
|
|
||||||
startLine: 51,
|
|
||||||
text: '<!-- markdownlint-disable-file -->',
|
|
||||||
type: 'content',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
startColumn: 1,
|
startColumn: 1,
|
||||||
startLine: 51,
|
startLine: 51,
|
||||||
text: '<!-- markdownlint-disable-file -->',
|
text: '<!-- markdownlint-disable-file -->',
|
||||||
|
|
Binary file not shown.
|
@ -10917,6 +10917,14 @@ Generated by [AVA](https://avajs.dev).
|
||||||
This \`is␊
|
This \`is␊
|
||||||
also␊
|
also␊
|
||||||
very\` **bad** {MD050}␊
|
very\` **bad** {MD050}␊
|
||||||
|
␊
|
||||||
|
<p>HTML __should__ *be* ignored</p>␊
|
||||||
|
␊
|
||||||
|
<p>␊
|
||||||
|
HTML __should__ *be* ignored␊
|
||||||
|
</p>␊
|
||||||
|
␊
|
||||||
|
<!-- markdownlint-configure-file { "no-inline-html": false } -->␊
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30582,7 +30590,7 @@ Generated by [AVA](https://avajs.dev).
|
||||||
insertText: `␊
|
insertText: `␊
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
lineNumber: 83,
|
lineNumber: 98,
|
||||||
ruleDescription: 'Files should end with a single newline character',
|
ruleDescription: 'Files should end with a single newline character',
|
||||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md047.md',
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md047.md',
|
||||||
ruleNames: [
|
ruleNames: [
|
||||||
|
@ -30679,7 +30687,22 @@ Generated by [AVA](https://avajs.dev).
|
||||||
␊
|
␊
|
||||||
text␊
|
text␊
|
||||||
␊
|
␊
|
||||||
|
<p>␊
|
||||||
|
1. Not a␊
|
||||||
|
2. list␊
|
||||||
|
</p>␊
|
||||||
|
␊
|
||||||
|
<p>1. Not a list</p>␊
|
||||||
|
␊
|
||||||
|
<p>␊
|
||||||
|
* Not a␊
|
||||||
|
* list␊
|
||||||
|
</p>␊
|
||||||
|
␊
|
||||||
|
<p>* Not a list</p>␊
|
||||||
|
␊
|
||||||
<!-- markdownlint-configure-file {␊
|
<!-- markdownlint-configure-file {␊
|
||||||
|
"no-inline-html": false,␊
|
||||||
"ul-style": false,␊
|
"ul-style": false,␊
|
||||||
"ol-prefix": false,␊
|
"ol-prefix": false,␊
|
||||||
"fenced-code-language": false␊
|
"fenced-code-language": false␊
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue