diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index cb23b8a7..6deb394b 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1417,6 +1417,25 @@ function micromarkParse(markdown) { return document; } +// /** +// * Log the structure of a Micromark token list. +// * +// * @param {Token[]} tokens Micromark tokens. +// * @param {number} depth Tree depth. +// * @returns {void} +// */ +// function consoleLogTokens(tokens, depth = 0) { +// for (const token of tokens) { +// const { children, text, type } = token; +// console.log( +// `${" ".repeat(depth * 2)}${type} ${text.replace(/\n/g, "\\n")}` +// ); +// if (children.length > 0) { +// consoleLogTokens(children, depth + 1); +// } +// } +// } + /** * Filter a list of Micromark tokens by predicate. * @@ -5753,20 +5772,21 @@ module.exports = { -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 _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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } 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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, 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 _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; } var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _require.addErrorDetailIf, escapeForRegExp = _require.escapeForRegExp, + newLineRe = _require.newLineRe, withinAnyRange = _require.withinAnyRange; var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"), filterByPredicate = _require2.filterByPredicate, @@ -5792,12 +5812,39 @@ module.exports = { scannedTypes.add("codeFlowValue"); scannedTypes.add("codeTextData"); } + var tokenAdjustments = new Map(); var contentTokens = filterByPredicate(params.parsers.micromark.tokens, function (token) { return scannedTypes.has(token.type); }, function (token) { var children = token.children; + var startLine = token.startLine, + text = token.text; if (!includeHtmlElements && token.type === "htmlFlow") { - children = children[0] && children[0].text === " + + + + + + + + + + javascript {MD044} + + javascript {MD044} + + + + + + + + + + + + javascript {MD044} + + javascript {MD044} + + +{MD044:107} {MD044:109} {MD044:112} {MD044:117} + ␊ ␊ ␊ ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + JavaScript {MD044}␊ + ␊ + JavaScript {MD044}␊ + ␊ + ␊ ␊ ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + ␊ + JavaScript {MD044}␊ + ␊ + JavaScript {MD044}␊ + ␊ + ␊ + {MD044:107} {MD044:109} {MD044:112} {MD044:117}␊ + ␊