diff --git a/.eslintrc.json b/.eslintrc.json index 6fb0c078..0c799131 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,7 +39,7 @@ "max-depth": "off", "max-lines": "off", "max-lines-per-function": "off", - "max-params": ["error", 10], + "max-params": ["off"], "max-statements": "off", "multiline-comment-style": ["error", "separate-lines"], "multiline-ternary": "off", @@ -70,15 +70,47 @@ "vars-on-top": "off", "wrap-regex": "off", + "jsdoc/check-access": "error", + "jsdoc/check-alignment": "error", "jsdoc/check-examples": "error", "jsdoc/check-indentation": "error", "jsdoc/check-line-alignment": "error", + "jsdoc/check-param-names": "error", + "jsdoc/check-property-names": "error", "jsdoc/check-syntax": "error", + "jsdoc/check-tag-names": "error", + "jsdoc/check-types": "error", + "jsdoc/check-values": "error", + "jsdoc/empty-tags": "error", + "jsdoc/implements-on-classes": "error", "jsdoc/match-description": "error", + "jsdoc/multiline-blocks": "error", + "jsdoc/newline-after-description": "error", "jsdoc/no-bad-blocks": "error", "jsdoc/no-defaults": "error", + "jsdoc/no-multi-asterisks": "error", + "jsdoc/no-undefined-types": "error", + "jsdoc/require-asterisk-prefix": "error", "jsdoc/require-description": "error", "jsdoc/require-description-complete-sentence": "error", + "jsdoc/require-jsdoc": "error", + "jsdoc/require-param": "error", + "jsdoc/require-param-description": "error", + "jsdoc/require-param-name": "error", + "jsdoc/require-param-type": "error", + "jsdoc/require-property": "error", + "jsdoc/require-property-description": "error", + "jsdoc/require-property-name": "error", + "jsdoc/require-property-type": "error", + "jsdoc/require-returns": "error", + "jsdoc/require-returns-check": "error", + "jsdoc/require-returns-description": "error", + "jsdoc/require-returns-type": "error", + "jsdoc/require-throws": "error", + "jsdoc/require-yields": "error", + "jsdoc/require-yields-check": "error", + "jsdoc/tag-lines": "error", + "jsdoc/valid-types": "error", "node/handle-callback-err": "error", "node/no-callback-literal": "error", @@ -139,9 +171,11 @@ "unicorn/no-abusive-eslint-disable": "error", "unicorn/no-array-callback-reference": "off", "unicorn/no-array-for-each": "off", + "unicorn/no-array-method-this-argument": "error", "unicorn/no-array-push-push": "error", "unicorn/no-array-reduce": "error", "unicorn/no-console-spaces": "error", + "unicorn/no-document-cookie": "error", "unicorn/no-for-loop": "error", "unicorn/no-hex-escape": "error", "unicorn/no-instanceof-array": "error", @@ -153,19 +187,24 @@ "unicorn/no-null": "off", "unicorn/no-object-as-default-parameter": "error", "unicorn/no-process-exit": "error", + "unicorn/no-static-only-class": "error", "unicorn/no-this-assignment": "error", "unicorn/no-unreadable-array-destructuring": "error", "unicorn/no-unsafe-regex": "off", "unicorn/no-unused-properties": "error", + "unicorn/no-useless-length-check": "error", + "unicorn/no-useless-spread": "error", "unicorn/no-useless-undefined": "error", "unicorn/no-zero-fractions": "error", "unicorn/number-literal-case": "error", "unicorn/numeric-separators-style": "error", "unicorn/prefer-add-event-listener": "error", "unicorn/prefer-array-find": "error", + "unicorn/prefer-array-flat": "error", "unicorn/prefer-array-flat-map": "error", "unicorn/prefer-array-index-of": "error", "unicorn/prefer-array-some": "error", + "unicorn/prefer-at": "off", "unicorn/prefer-date-now": "error", "unicorn/prefer-default-parameters": "error", "unicorn/prefer-dom-node-append": "error", @@ -176,9 +215,14 @@ "unicorn/prefer-keyboard-event-key": "error", "unicorn/prefer-math-trunc": "error", "unicorn/prefer-modern-dom-apis": "error", + "unicorn/prefer-module": "off", "unicorn/prefer-negative-index": "error", + "unicorn/prefer-node-protocol": "error", "unicorn/prefer-number-properties": "error", + "unicorn/prefer-object-from-entries": "error", + "unicorn/prefer-object-has-own": "error", "unicorn/prefer-optional-catch-binding": "error", + "unicorn/prefer-prototype-methods": "error", "unicorn/prefer-query-selector": "error", "unicorn/prefer-reflect-apply": "error", "unicorn/prefer-regexp-test": "error", @@ -188,9 +232,14 @@ "unicorn/prefer-string-slice": "off", "unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-trim-start-end": "error", + "unicorn/prefer-switch": "off", "unicorn/prefer-ternary": "error", + "unicorn/prefer-top-level-await": "error", "unicorn/prefer-type-error": "error", "unicorn/prevent-abbreviations": "off", + "unicorn/require-array-join-separator": "error", + "unicorn/require-number-to-fixed-digits-argument": "error", + "unicorn/require-post-message-target-origin": "error", "unicorn/string-content": "error", "unicorn/throw-new-error": "error" }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a91ca27..a12dd3bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,12 +16,12 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node-version: [10.x, 12.x, 14.x, 15.x] + node-version: [12.x, 14.x, 16.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Install Dependencies diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1fdeba37..77ae5e58 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,11 +20,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - name: Initialize CodeQL uses: github/codeql-action/init@v1 diff --git a/.github/workflows/test-repos.yml b/.github/workflows/test-repos.yml index 751e1b79..7ff15af6 100644 --- a/.github/workflows/test-repos.yml +++ b/.github/workflows/test-repos.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Install Dependencies diff --git a/README.md b/README.md index 85d6a722..3439ca31 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ > A Node.js style checker and lint tool for Markdown/CommonMark files. [![npm version][npm-image]][npm-url] -[![CI Status][ci-image]][ci-url] [![License][license-image]][license-url] ## Install @@ -295,7 +294,8 @@ function markdownlint(options) { ... } Type: `Object` -Configures the function. +Configures the function. All properties are optional, but at least one +of `files` or `strings` should be set to provide input. ##### options.customRules @@ -535,6 +535,16 @@ Each item in the top-level `Array` should be of the form: [ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ] ``` +##### options.fs + +Type: `Object` implementing the [file system API](https://nodejs.org/api/fs.html) + +In advanced scenarios, it may be desirable to bypass the default file system API. +If a custom file system implementation is provided, `markdownlint` will use that +instead of invoking `require("fs")`. + +Note: The only methods called are `readFile` and `readFileSync`. + #### callback Type: `Function` taking (`Error`, `Object`) @@ -567,10 +577,11 @@ Asynchronous API: * * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { ... } +function readConfig(file, parsers, fs, callback) { ... } ``` Synchronous API: @@ -581,13 +592,14 @@ Synchronous API: * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. */ -function readConfigSync(file, parsers) { ... } +function readConfigSync(file, parsers, fs) { ... } ``` Promise API (in the `promises` namespace like Node.js's -[`fs` Promises API](https://nodejs.org/api/fs.html#fs_fs_promises_api)): +[`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)): ```js /** @@ -595,9 +607,10 @@ Promise API (in the `promises` namespace like Node.js's * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfig(file, parsers) { ... } +function readConfig(file, parsers, fs) { ... } ``` #### file @@ -628,6 +641,16 @@ For example: [ JSON.parse, require("toml").parse, require("js-yaml").load ] ``` +#### fs + +Type: *Optional* `Object` implementing the [file system API](https://nodejs.org/api/fs.html) + +In advanced scenarios, it may be desirable to bypass the default file system API. +If a custom file system implementation is provided, `markdownlint` will use that +instead of invoking `require("fs")`. + +Note: The only methods called are `readFile`, `readFileSync`, `access`, and `accessSync`. + #### callback Type: `Function` taking (`Error`, `Object`) @@ -835,7 +858,8 @@ const results = window.markdownlint.sync(options).toString(); ## Examples -For ideas how to integrate `markdownlint` into your workflow, refer to the following projects: +For ideas how to integrate `markdownlint` into your workflow, refer to the +following projects or one of the tools in the [Related section](#Related): * [.NET Documentation](https://docs.microsoft.com/en-us/dotnet/) ([Search repository](https://github.com/dotnet/docs/search?q=markdownlint)) * [ally.js](https://allyjs.io/) ([Search repository](https://github.com/medialize/ally.js/search?q=markdownlint)) @@ -843,12 +867,12 @@ For ideas how to integrate `markdownlint` into your workflow, refer to the follo * [CodiMD](https://github.com/hackmdio/codimd) ([Search repository](https://github.com/hackmdio/codimd/search?q=markdownlint)) * [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint)) * [Garden React Components](https://zendeskgarden.github.io/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint)) +* [MDN Web Docs](https://developer.mozilla.org/) ([Search repository](https://github.com/mdn/content/search?q=markdownlint)) * [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint)) * [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint)) * [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint)) * [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint)) * [TestCafe](https://devexpress.github.io/testcafe/) ([Search repository](https://github.com/DevExpress/testcafe/search?q=markdownlint)) -* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) ([Search repository](https://github.com/Microsoft/TypeScript-Handbook/search?q=markdownlint)) * [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint)) * [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint)) * [webpack](https://webpack.js.org/) ([Search repository](https://github.com/webpack/webpack.js.org/search?q=markdownlint)) @@ -941,10 +965,11 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information. information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve HTML comment handling, update test runner and test suite, update dependencies. * 0.23.1 - Work around lack of webpack support for dynamic calls to `require` (`.resolve`). +* 0.24.0 - Remove support for end-of-life Node version 10, add support for custom file system + module, improve MD010/MD011/MD037/MD043/MD044, improve TypeScript declaration file + and JSON schema, update dependencies. [npm-image]: https://img.shields.io/npm/v/markdownlint.svg [npm-url]: https://www.npmjs.com/package/markdownlint -[ci-image]: https://github.com/DavidAnson/markdownlint/workflows/CI/badge.svg?branch=main -[ci-url]: https://github.com/DavidAnson/markdownlint/actions?query=branch%3Amain [license-image]: https://img.shields.io/npm/l/markdownlint.svg [license-url]: https://opensource.org/licenses/MIT diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 701f7526..3fd61ef7 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1,5 +1,5 @@ -/*! markdownlint 0.23.1 https://github.com/DavidAnson/markdownlint @license MIT */ -var markdownlint;markdownlint = +/*! markdownlint 0.24.0 https://github.com/DavidAnson/markdownlint @license MIT */ +var markdownlint; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ @@ -30,7 +30,7 @@ module.exports = webpackEmptyContext; "use strict"; // @ts-check -var os = __webpack_require__(/*! os */ "?5533"); +var os = __webpack_require__(/*! os */ "?591e"); // Regular expression for matching common newline characters // See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js var newLineRe = /\r\n?|\n/g; @@ -51,7 +51,10 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/; // Regular expression for all instances of emphasis markers var emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links -var linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; +var linkRe = /(\[(?:[^[\]]|\[[^\]]*\])*\])(\(\S*\)|\[\S*\])?/g; +module.exports.linkRe = linkRe; +// Regular expression for link reference definition lines +module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; // All punctuation characters (normal and full-width) var allPunctuation = ".,;:!?。,;:!?"; module.exports.allPunctuation = allPunctuation; @@ -298,14 +301,14 @@ module.exports.forEachLine = function forEachLine(lineMetadata, handler) { }); }; // Returns (nested) lists as a flat array (in order) -module.exports.flattenLists = function flattenLists(params) { +module.exports.flattenLists = function flattenLists(tokens) { var flattenedLists = []; var stack = []; var current = null; var nesting = 0; var nestingStack = []; var lastWithMap = { "map": [0, 1] }; - params.tokens.forEach(function (token) { + tokens.forEach(function (token) { if (isMathBlock(token) && token.map[1]) { // markdown-it-texmath plugin does not account for math_block_end token.map[1]++; @@ -514,6 +517,36 @@ module.exports.addErrorContext = function addErrorContext(onError, lineNumber, c } addError(onError, lineNumber, null, context, range, fixInfo); }; +/** + * Returns an array of code span ranges. + * + * @param {string[]} lines Lines to scan for code span ranges. + * @returns {number[][]} Array of ranges (line, index, length). + */ +module.exports.inlineCodeSpanRanges = function (lines) { + var exclusions = []; + forEachInlineCodeSpan(lines.join("\n"), function (code, lineIndex, columnIndex) { + var codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (var i = 0; i < codeLines.length; i++) { + exclusions.push([lineIndex + i, columnIndex, codeLines[i].length]); + columnIndex = 0; + } + }); + return exclusions; +}; +/** + * Determines whether the specified range overlaps another range. + * + * @param {number[][]} ranges Array of ranges (line, index, length). + * @param {number} lineIndex Line index to check. + * @param {number} index Index to check. + * @param {number} length Length to check. + * @returns {boolean} True iff the specified range overlaps. + */ +module.exports.overlapsAnyRange = function (ranges, lineIndex, index, length) { return (!ranges.every(function (span) { return ((lineIndex !== span[0]) || + (index + length < span[1]) || + (index > span[1] + span[2])); })); }; // Returns a range object for a line by applying a RegExp module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) { var range = null; @@ -725,13 +758,6 @@ module.exports.applyFixes = function applyFixes(input, errors) { "use strict"; // @ts-check -var lineMetadata = null; -module.exports.lineMetadata = function (value) { - if (value) { - lineMetadata = value; - } - return lineMetadata; -}; var flattenedLists = null; module.exports.flattenedLists = function (value) { if (value) { @@ -739,9 +765,24 @@ module.exports.flattenedLists = function (value) { } return flattenedLists; }; +var inlineCodeSpanRanges = null; +module.exports.inlineCodeSpanRanges = function (value) { + if (value) { + inlineCodeSpanRanges = value; + } + return inlineCodeSpanRanges; +}; +var lineMetadata = null; +module.exports.lineMetadata = function (value) { + if (value) { + lineMetadata = value; + } + return lineMetadata; +}; module.exports.clear = function () { - lineMetadata = null; flattenedLists = null; + inlineCodeSpanRanges = null; + lineMetadata = null; }; @@ -767,16 +808,13 @@ var __assign = (this && this.__assign) || function () { }; return __assign.apply(this, arguments); }; -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; }; -var fs = __webpack_require__(/*! fs */ "?65c5"); -var path = __webpack_require__(/*! path */ "?0f27"); -var promisify = __webpack_require__(/*! util */ "?0bed").promisify; +var path = __webpack_require__(/*! path */ "?b85c"); +var promisify = __webpack_require__(/*! util */ "?96a2").promisify; var markdownIt = __webpack_require__(/*! markdown-it */ "markdown-it"); var rules = __webpack_require__(/*! ./rules */ "../lib/rules.js"); var helpers = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"); @@ -950,7 +988,7 @@ function annotateTokens(tokens, lines) { // Handle missing maps for table head/body if ((token.type === "thead_open") || (token.type === "tbody_open")) { - tableMap = token.map.slice(); + tableMap = __spreadArray([], token.map); } else if ((token.type === "tr_close") && tableMap) { @@ -961,7 +999,7 @@ function annotateTokens(tokens, lines) { tableMap = null; } if (tableMap && !token.map) { - token.map = tableMap.slice(); + token.map = __spreadArray([], tableMap); } // Update token metadata if (token.map) { @@ -1235,7 +1273,8 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul frontMatterLines: frontMatterLines }; cache.lineMetadata(helpers.getLineMetadata(params)); - cache.flattenedLists(helpers.flattenLists(params)); + cache.flattenedLists(helpers.flattenLists(params.tokens)); + cache.inlineCodeSpanRanges(helpers.inlineCodeSpanRanges(params.lines)); // Function to run for each rule var result = (resultVersion === 0) ? {} : []; // eslint-disable-next-line jsdoc/require-jsdoc @@ -1321,7 +1360,7 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul "lineNumber": errorInfo.lineNumber + frontMatterLines.length, "detail": errorInfo.detail || null, "context": errorInfo.context || null, - "range": errorInfo.range ? __spreadArrays(errorInfo.range) : null, + "range": errorInfo.range ? __spreadArray([], errorInfo.range) : null, "fixInfo": fixInfo ? cleanFixInfo : null }); } @@ -1406,11 +1445,12 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul * @param {boolean} handleRuleFailures Whether to handle exceptions in rules. * @param {boolean} noInlineConfig Whether to allow inline configuration. * @param {number} resultVersion Version of the LintResults object to return. + * @param {Object} fs File system implementation. * @param {boolean} synchronous Whether to execute synchronously. * @param {Function} callback Callback (err, result) function. * @returns {void} */ -function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, callback) { +function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, callback) { // eslint-disable-next-line jsdoc/require-jsdoc function lintContentWrapper(err, content) { if (err) { @@ -1420,7 +1460,6 @@ function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, n } // Make a/synchronous call to read file if (synchronous) { - // @ts-ignore lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { @@ -1447,7 +1486,7 @@ function lintInput(options, synchronous, callback) { } var files = []; if (Array.isArray(options.files)) { - files = options.files.slice(); + files = __spreadArray([], options.files); } else if (options.files) { files = [String(options.files)]; @@ -1467,6 +1506,7 @@ function lintInput(options, synchronous, callback) { // @ts-ignore md.use.apply(md, plugin); }); + var fs = options.fs || __webpack_require__(/*! fs */ "?ec0a"); var results = newResults(ruleList); var done = false; // Linting of strings is always synchronous @@ -1486,7 +1526,7 @@ function lintInput(options, synchronous, callback) { if (synchronous) { // Lint files synchronously while (!done && (syncItem = files.shift())) { - lintFile(ruleList, syncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, syncCallback); + lintFile(ruleList, syncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, syncCallback); } return done || callback(null, results); } @@ -1500,7 +1540,7 @@ function lintInput(options, synchronous, callback) { } else if (asyncItem) { concurrency++; - lintFile(ruleList, asyncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, function (err, result) { + lintFile(ruleList, asyncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, function (err, result) { concurrency--; if (err) { done = true; @@ -1604,24 +1644,51 @@ function parseConfiguration(name, content, parsers) { * * @param {string} configFile Configuration file name. * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. + * @param {ResolveConfigExtendsCallback} [callback] Callback (err, result) + * function. + * @returns {void} + */ +function resolveConfigExtends(configFile, referenceId, fs, callback) { + var configFileDirname = path.dirname(configFile); + var resolvedExtendsFile = path.resolve(configFileDirname, referenceId); + fs.access(resolvedExtendsFile, function (err) { + if (err) { + // Not a file, try require.resolve + try { + return callback(null, dynamicRequire.resolve(referenceId, { "paths": [configFileDirname] })); + } + catch (_a) { + // Unable to resolve, use resolvedExtendsFile + } + } + return callback(null, resolvedExtendsFile); + }); +} +/** + * Resolve referenced "extends" path in a configuration file + * using path.resolve() with require.resolve() as a fallback. + * + * @param {string} configFile Configuration file name. + * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId) { +function resolveConfigExtendsSync(configFile, referenceId, fs) { var configFileDirname = path.dirname(configFile); var resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { - if (fs.statSync(resolvedExtendsFile).isFile()) { - return resolvedExtendsFile; - } + fs.accessSync(resolvedExtendsFile); + return resolvedExtendsFile; } catch (_a) { - // If not a file or fs.statSync throws, try require.resolve + // Not a file, try require.resolve } try { return dynamicRequire.resolve(referenceId, { "paths": [configFileDirname] }); } catch (_b) { - // If require.resolve throws, return resolvedExtendsFile + // Unable to resolve, return resolvedExtendsFile } return resolvedExtendsFile; } @@ -1631,14 +1698,24 @@ function resolveConfigExtends(configFile, referenceId) { * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { +function readConfig(file, parsers, fs, callback) { if (!callback) { - // @ts-ignore - callback = parsers; - parsers = null; + if (fs) { + callback = fs; + fs = null; + } + else { + // @ts-ignore + callback = parsers; + parsers = null; + } + } + if (!fs) { + fs = __webpack_require__(/*! fs */ "?ec0a"); } // Read file fs.readFile(file, "utf8", function (err, content) { @@ -1655,13 +1732,12 @@ function readConfig(file, parsers, callback) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends); - return readConfig(resolvedExtends, parsers, function (errr, extendsConfig) { + return resolveConfigExtends(file, configExtends, fs, function (_, resolvedExtends) { return readConfig(resolvedExtends, parsers, fs, function (errr, extendsConfig) { if (errr) { return callback(errr); } return callback(null, __assign(__assign({}, extendsConfig), config)); - }); + }); }); } return callback(null, config); }); @@ -1672,22 +1748,27 @@ var readConfigPromisify = promisify && promisify(readConfig); * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfigPromise(file, parsers) { +function readConfigPromise(file, parsers, fs) { // @ts-ignore - return readConfigPromisify(file, parsers); + return readConfigPromisify(file, parsers, fs); } /** * Read specified configuration file synchronously. * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ -function readConfigSync(file, parsers) { +function readConfigSync(file, parsers, fs) { + if (!fs) { + fs = __webpack_require__(/*! fs */ "?ec0a"); + } // Read file - // @ts-ignore var content = fs.readFileSync(file, "utf8"); // Try to parse file var _a = parseConfiguration(file, content, parsers), config = _a.config, message = _a.message; @@ -1698,8 +1779,8 @@ function readConfigSync(file, parsers) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends); - return __assign(__assign({}, readConfigSync(resolvedExtends, parsers)), config); + var resolvedExtends = resolveConfigExtendsSync(file, configExtends, fs); + return __assign(__assign({}, readConfigSync(resolvedExtends, parsers, fs)), config); } return config; } @@ -2141,6 +2222,10 @@ module.exports = { "function": function MD010(params, onError) { var codeBlocks = params.config.code_blocks; var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; + var spacesPerTab = params.config.spaces_per_tab; + var spaceMultiplier = (spacesPerTab === undefined) ? + 1 : + Math.max(0, Number(spacesPerTab)); forEachLine(lineMetadata(), function (line, lineIndex, inCode) { if (!inCode || includeCodeBlocks) { var match = null; @@ -2150,7 +2235,7 @@ module.exports = { addError(onError, lineIndex + 1, "Column: " + column, null, [column, length_1], { "editColumn": column, "deleteCount": length_1, - "insertText": "".padEnd(length_1) + "insertText": "".padEnd(length_1 * spaceMultiplier) }); } } @@ -2170,30 +2255,32 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachInlineChild = _a.forEachInlineChild, unescapeMarkdown = _a.unescapeMarkdown; -var reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachLine = _a.forEachLine, overlapsAnyRange = _a.overlapsAnyRange; +var _b = __webpack_require__(/*! ./cache */ "../lib/cache.js"), inlineCodeSpanRanges = _b.inlineCodeSpanRanges, lineMetadata = _b.lineMetadata; +var reversedLinkRe = /(^|[^\\])\(([^)]+)\)\[([^\]^][^\]]*)](?!\()/g; module.exports = { "names": ["MD011", "no-reversed-links"], "description": "Reversed link syntax", "tags": ["links"], "function": function MD011(params, onError) { - forEachInlineChild(params, "text", function (token) { - var lineNumber = token.lineNumber, content = token.content; - var match = null; - while ((match = reversedLinkRe.exec(content)) !== null) { - var reversedLink = match[0], linkText = match[1], linkDestination = match[2]; - var line = params.lines[lineNumber - 1]; - var column = unescapeMarkdown(line).indexOf(reversedLink) + 1; - var length_1 = reversedLink.length; - var range = column ? [column, length_1] : null; - var fixInfo = column ? - { - "editColumn": column, - "deleteCount": length_1, - "insertText": "[" + linkText + "](" + linkDestination + ")" - } : - null; - addError(onError, lineNumber, reversedLink, null, range, fixInfo); + var exclusions = inlineCodeSpanRanges(); + forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence) { + if (!inCode && !onFence) { + var match = null; + while ((match = reversedLinkRe.exec(line)) !== null) { + var reversedLink = match[0], preChar = match[1], linkText = match[2], linkDestination = match[3]; + var index = match.index + preChar.length; + var length_1 = match[0].length - preChar.length; + if (!linkText.endsWith("\\") && + !linkDestination.endsWith("\\") && + !overlapsAnyRange(exclusions, lineIndex, index, length_1)) { + addError(onError, lineIndex + 1, reversedLink.slice(preChar.length), null, [index + 1, length_1], { + "editColumn": index + 1, + "deleteCount": length_1, + "insertText": "[" + linkText + "](" + linkDestination + ")" + }); + } + } } }); } @@ -3328,11 +3415,19 @@ module.exports = { resetRunTracking(); forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) { var onItemStart = (inItem === 1); - if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) { + if (inCode || + onFence || + inTable || + onBreak || + onItemStart || + isBlankLine(line)) { // Emphasis resets when leaving a block resetRunTracking(); } - if (inCode || onBreak || inMath) { + if (inCode || + onFence || + onBreak || + inMath) { // Emphasis has no meaning here return; } @@ -3697,8 +3792,11 @@ module.exports = { var actual = levels_1[heading.tag] + " " + content; var expected = getExpected_1(); if (expected === "*") { - matchAny_1 = true; - getExpected_1(); + var nextExpected = getExpected_1(); + if (nextExpected.toLowerCase() !== actual.toLowerCase()) { + matchAny_1 = true; + i_1--; + } } else if (expected === "+") { matchAny_1 = true; @@ -3715,8 +3813,10 @@ module.exports = { } } }); + var extraHeadings = requiredHeadings.length - i_1; if (!hasError_1 && - (i_1 < requiredHeadings.length) && + ((extraHeadings > 1) || + ((extraHeadings === 1) && (requiredHeadings[i_1] !== "*"))) && (anyHeadings_1 || !requiredHeadings.every(function (heading) { return heading === "*"; }))) { addErrorContext(onError, params.lines.length, requiredHeadings[i_1]); } @@ -3736,9 +3836,8 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, filterTokens = _a.filterTokens, forEachInlineChild = _a.forEachInlineChild, newLineRe = _a.newLineRe; -var startNonWordRe = /^\W/; -var endNonWordRe = /\W$/; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, forEachLine = _a.forEachLine, overlapsAnyRange = _a.overlapsAnyRange, linkRe = _a.linkRe, linkReferenceRe = _a.linkReferenceRe; +var _b = __webpack_require__(/*! ./cache */ "../lib/cache.js"), inlineCodeSpanRanges = _b.inlineCodeSpanRanges, lineMetadata = _b.lineMetadata; module.exports = { "names": ["MD044", "proper-names"], "description": "Proper names should have the correct capitalization", @@ -3746,73 +3845,59 @@ module.exports = { "function": function MD044(params, onError) { var names = params.config.names; names = Array.isArray(names) ? names : []; + names.sort(function (a, b) { return (b.length - a.length) || a.localeCompare(b); }); var codeBlocks = params.config.code_blocks; var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; - // Text of automatic hyperlinks is implicitly a URL - var autolinkText = new Set(); - filterTokens(params, "inline", function (token) { - var inAutoLink = false; - token.children.forEach(function (child) { - var info = child.info, type = child.type; - if ((type === "link_open") && (info === "auto")) { - inAutoLink = true; + var exclusions = []; + forEachLine(lineMetadata(), function (line, lineIndex) { + if (linkReferenceRe.test(line)) { + exclusions.push([lineIndex, 0, line.length]); + } + else { + var match = null; + while ((match = bareUrlRe.exec(line)) !== null) { + exclusions.push([lineIndex, match.index, match[0].length]); } - else if (type === "link_close") { - inAutoLink = false; + while ((match = linkRe.exec(line)) !== null) { + var text = match[1], destination = match[2]; + if (destination) { + exclusions.push([lineIndex, match.index + text.length, destination.length]); + } } - else if ((type === "text") && inAutoLink) { - autolinkText.add(child); + } + }); + if (!includeCodeBlocks) { + exclusions.push.apply(exclusions, inlineCodeSpanRanges()); + } + var _loop_1 = function (name_1) { + var escapedName = escapeForRegExp(name_1); + var startNamePattern = /^\W/.test(name_1) ? "" : "\\b_*"; + var endNamePattern = /\W$/.test(name_1) ? "" : "_*\\b"; + var namePattern = "(" + startNamePattern + ")(" + escapedName + ")" + endNamePattern; + var nameRe = new RegExp(namePattern, "gi"); + forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence) { + if (includeCodeBlocks || (!inCode && !onFence)) { + var match = null; + while ((match = nameRe.exec(line)) !== null) { + var leftMatch = match[1], nameMatch = match[2]; + var index = match.index + leftMatch.length; + var length_1 = nameMatch.length; + if (!overlapsAnyRange(exclusions, lineIndex, index, length_1)) { + addErrorDetailIf(onError, lineIndex + 1, name_1, nameMatch, null, null, [index + 1, length_1], { + "editColumn": index + 1, + "deleteCount": length_1, + "insertText": name_1 + }); + } + exclusions.push([lineIndex, index, length_1]); + } } }); - }); - // For each proper name... - names.forEach(function (name) { - var escapedName = escapeForRegExp(name); - var startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b"; - var endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*"; - var namePattern = "(" + startNamePattern + ")(" + escapedName + ")(" + endNamePattern + ")"; - var anyNameRe = new RegExp(namePattern, "gi"); - // eslint-disable-next-line jsdoc/require-jsdoc - function forToken(token) { - if (!autolinkText.has(token)) { - var fenceOffset_1 = (token.type === "fence") ? 1 : 0; - token.content.split(newLineRe).forEach(function (line, index) { - var match = null; - while ((match = anyNameRe.exec(line)) !== null) { - var fullMatch = match[0], leftMatch = match[1], nameMatch = match[2], rightMatch = match[3]; - if (fullMatch.search(bareUrlRe) === -1) { - var wordMatch = fullMatch - .replace(new RegExp("^\\W{0," + leftMatch.length + "}"), "") - .replace(new RegExp("\\W{0," + rightMatch.length + "}$"), ""); - if (!names.includes(wordMatch)) { - var lineNumber = token.lineNumber + index + fenceOffset_1; - var fullLine = params.lines[lineNumber - 1]; - var matchLength = wordMatch.length; - var matchIndex = fullLine.indexOf(wordMatch); - var range = (matchIndex === -1) ? - null : - [matchIndex + 1, matchLength]; - var fixInfo = (matchIndex === -1) ? - null : - { - "editColumn": matchIndex + 1, - "deleteCount": matchLength, - "insertText": name - }; - addErrorDetailIf(onError, lineNumber, name, nameMatch, null, null, range, fixInfo); - } - } - } - }); - } - } - forEachInlineChild(params, "text", forToken); - if (includeCodeBlocks) { - forEachInlineChild(params, "code_inline", forToken); - filterTokens(params, "code_block", forToken); - filterTokens(params, "fence", forToken); - } - }); + }; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_1 = names_1[_i]; + _loop_1(name_1); + } } }; @@ -4008,17 +4093,6 @@ rules.forEach(function (rule) { module.exports = rules; -/***/ }), - -/***/ "../package.json": -/*!***********************!*\ - !*** ../package.json ***! - \***********************/ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.23.1\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.4\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~31.6.0\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~27.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}"); - /***/ }), /***/ "markdown-it": @@ -4032,17 +4106,7 @@ module.exports = markdownit; /***/ }), -/***/ "?65c5": -/*!********************!*\ - !*** fs (ignored) ***! - \********************/ -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ "?5533": +/***/ "?591e": /*!********************!*\ !*** os (ignored) ***! \********************/ @@ -4052,7 +4116,17 @@ module.exports = markdownit; /***/ }), -/***/ "?0f27": +/***/ "?ec0a": +/*!********************!*\ + !*** fs (ignored) ***! + \********************/ +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ "?b85c": /*!**********************!*\ !*** path (ignored) ***! \**********************/ @@ -4062,7 +4136,7 @@ module.exports = markdownit; /***/ }), -/***/ "?0bed": +/***/ "?96a2": /*!**********************!*\ !*** util (ignored) ***! \**********************/ @@ -4070,6 +4144,17 @@ module.exports = markdownit; /* (ignored) */ +/***/ }), + +/***/ "../package.json": +/*!***********************!*\ + !*** ../package.json ***! + \***********************/ +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"name":"markdownlint","version":"0.24.0","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.8.0","cpy-cli":"~3.1.1","eslint":"~7.32.0","eslint-plugin-jsdoc":"~36.0.7","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~35.0.0","globby":"~11.0.4","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.1","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.5","tv4":"~1.3.0","typescript":"~4.3.5","webpack":"~5.51.1","webpack-cli":"~4.8.0"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); + /***/ }) /******/ }); @@ -4080,8 +4165,9 @@ module.exports = markdownit; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -4104,9 +4190,12 @@ module.exports = markdownit; /******/ })(); /******/ /************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ /******/ // startup /******/ // Load entry module and return exports -/******/ return __webpack_require__("../lib/markdownlint.js"); +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__("../lib/markdownlint.js"); +/******/ markdownlint = __webpack_exports__; +/******/ /******/ })() ; \ No newline at end of file diff --git a/doc/Prettier.md b/doc/Prettier.md new file mode 100644 index 00000000..5221995e --- /dev/null +++ b/doc/Prettier.md @@ -0,0 +1,23 @@ +# Using markdownlint with Prettier + +[`Prettier`](https://prettier.io) is a popular code formatter. For the most part, +it works seamlessly with `markdownlint`. Special situations are documented +below. + +## List item indentation + +The default settings of `markdownlint` and `Prettier` are compatible and don't +result in any linting violations. If `Prettier` is used with `--tab-width` set +to `4`, the following `markdownlint` configuration can be used: + +```json +{ + "MD007": { + "indent": 4 + }, + "MD030": { + "ul_single": 3, + "ul_multi": 3 + } +} +``` diff --git a/doc/Rules.md b/doc/Rules.md index 73e458c6..7ca6afb8 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -329,6 +329,8 @@ issue for multi-markdown parsers, which require 4-space indents. More informatio and . +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD009 - Trailing spaces @@ -388,7 +390,7 @@ Tags: whitespace, hard_tab Aliases: no-hard-tabs -Parameters: code_blocks (boolean; default true) +Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1) Fixable: Most violations can be fixed by tooling @@ -420,6 +422,9 @@ You have the option to exclude this rule for code blocks. To do so, set the `code_blocks` parameter to `false`. Code blocks are included by default since handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces). +If you would like the fixer to change tabs to x spaces, then configure the `spaces_per_tab` +parameter to the number x. The default value would be 1. + Rationale: Hard tabs are often rendered inconsistently by different editors and can be harder to work with than spaces. @@ -1180,6 +1185,8 @@ for your selected document style. Rationale: Violations of this rule can lead to improperly rendered content. +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD031 - Fenced code blocks should be surrounded by blank lines @@ -1569,6 +1576,14 @@ echo Hello world ``` ```` +To display a code block without syntax highlighting, use: + +````markdown +```text +Plain text in a code block +``` +```` + Rationale: Specifying a language improves content rendering by using the correct syntax highlighting for code. More information: . diff --git a/example/typescript/type-check.ts b/example/typescript/type-check.ts index def7d776..3d0ee90b 100644 --- a/example/typescript/type-check.ts +++ b/example/typescript/type-check.ts @@ -34,13 +34,14 @@ function assertLintResults(results: markdownlint.LintResults) { assert.equal(results["string"][0].errorDetail, null); assert.equal(results["string"][0].errorContext, null); assert.deepEqual(results["string"][0].errorRange, [ 9, 1 ]); - assert(!!results["string"][0].fixInfo); - // @ts-ignore - assert.equal(results["string"][0].fixInfo.editColumn, 10); - // @ts-ignore - assert(!results["string"][0].fixInfo.deleteCount); - // @ts-ignore - assert.equal(results["string"][0].fixInfo.insertText, "\n"); + const fixInfo = results["string"][0].fixInfo; + assert(!!fixInfo); + if (fixInfo) { + assert.equal(fixInfo.lineNumber, null); + assert.equal(fixInfo.editColumn, 10); + assert(!fixInfo.deleteCount); + assert.equal(fixInfo.insertText, "\n"); + } assert.equal(results["../bad.md"].length, 2); // Deliberate assignment to unused variable validates types // False-positive for js/useless-assignment-to-local diff --git a/helpers/helpers.js b/helpers/helpers.js index bcec394f..a1b10952 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -29,7 +29,11 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/; const emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links -const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; +const linkRe = /(\[(?:[^[\]]|\[[^\]]*\])*\])(\(\S*\)|\[\S*\])?/g; +module.exports.linkRe = linkRe; + +// Regular expression for link reference definition lines +module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; // All punctuation characters (normal and full-width) const allPunctuation = ".,;:!?。,;:!?"; @@ -299,14 +303,14 @@ module.exports.forEachLine = function forEachLine(lineMetadata, handler) { }; // Returns (nested) lists as a flat array (in order) -module.exports.flattenLists = function flattenLists(params) { +module.exports.flattenLists = function flattenLists(tokens) { const flattenedLists = []; const stack = []; let current = null; let nesting = 0; const nestingStack = []; let lastWithMap = { "map": [ 0, 1 ] }; - params.tokens.forEach((token) => { + tokens.forEach((token) => { if (isMathBlock(token) && token.map[1]) { // markdown-it-texmath plugin does not account for math_block_end token.map[1]++; @@ -516,6 +520,47 @@ module.exports.addErrorContext = function addErrorContext( addError(onError, lineNumber, null, context, range, fixInfo); }; +/** + * Returns an array of code span ranges. + * + * @param {string[]} lines Lines to scan for code span ranges. + * @returns {number[][]} Array of ranges (line, index, length). + */ +module.exports.inlineCodeSpanRanges = (lines) => { + const exclusions = []; + forEachInlineCodeSpan( + lines.join("\n"), + (code, lineIndex, columnIndex) => { + const codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (let i = 0; i < codeLines.length; i++) { + exclusions.push( + [ lineIndex + i, columnIndex, codeLines[i].length ] + ); + columnIndex = 0; + } + } + ); + return exclusions; +}; + +/** + * Determines whether the specified range overlaps another range. + * + * @param {number[][]} ranges Array of ranges (line, index, length). + * @param {number} lineIndex Line index to check. + * @param {number} index Index to check. + * @param {number} length Length to check. + * @returns {boolean} True iff the specified range overlaps. + */ +module.exports.overlapsAnyRange = (ranges, lineIndex, index, length) => ( + !ranges.every((span) => ( + (lineIndex !== span[0]) || + (index + length < span[1]) || + (index > span[1] + span[2]) + )) +); + // Returns a range object for a line by applying a RegExp module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) { let range = null; diff --git a/helpers/package.json b/helpers/package.json index 489fdeb7..5b25454e 100644 --- a/helpers/package.json +++ b/helpers/package.json @@ -1,6 +1,6 @@ { "name": "markdownlint-rule-helpers", - "version": "0.14.0", + "version": "0.15.0", "description": "A collection of markdownlint helper functions for custom rules", "main": "helpers.js", "author": "David Anson (https://dlaa.me/)", diff --git a/lib/cache.js b/lib/cache.js index bd5ebe8a..a2ad39af 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -2,14 +2,6 @@ "use strict"; -let lineMetadata = null; -module.exports.lineMetadata = (value) => { - if (value) { - lineMetadata = value; - } - return lineMetadata; -}; - let flattenedLists = null; module.exports.flattenedLists = (value) => { if (value) { @@ -18,7 +10,24 @@ module.exports.flattenedLists = (value) => { return flattenedLists; }; -module.exports.clear = () => { - lineMetadata = null; - flattenedLists = null; +let inlineCodeSpanRanges = null; +module.exports.inlineCodeSpanRanges = (value) => { + if (value) { + inlineCodeSpanRanges = value; + } + return inlineCodeSpanRanges; +}; + +let lineMetadata = null; +module.exports.lineMetadata = (value) => { + if (value) { + lineMetadata = value; + } + return lineMetadata; +}; + +module.exports.clear = () => { + flattenedLists = null; + inlineCodeSpanRanges = null; + lineMetadata = null; }; diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index 7a6199e3..f59ef569 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -8,7 +8,7 @@ export = markdownlint; */ declare function markdownlint(options: Options, callback: LintCallback): void; declare namespace markdownlint { - export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback }; + export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback, ResolveConfigExtendsCallback }; } /** * Configuration options. @@ -52,9 +52,13 @@ type Options = { * Additional plugins. */ markdownItPlugins?: Plugin[]; + /** + * File system implementation. + */ + fs?: any; }; /** - * Called with the result of the lint operation. + * Called with the result of the lint function. */ type LintCallback = (err: Error | null, results?: LintResults) => void; /** @@ -70,18 +74,21 @@ declare function markdownlintSync(options: Options): LintResults; * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, callback?: ReadConfigCallback): void; +declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void; /** * Read specified configuration file synchronously. * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ -declare function readConfigSync(file: string, parsers?: ConfigurationParser[]): Configuration; +declare function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration; /** * Gets the (semantic) version of the library. * @@ -316,6 +323,10 @@ type LintError = { * Fix information. */ type FixInfo = { + /** + * Line number (1-based). + */ + lineNumber?: number; /** * Column of the fix (1-based). */ @@ -334,20 +345,24 @@ type FixInfo = { * {@link ../schema/markdownlint-config-schema.json}. */ type Configuration = { - [x: string]: any; + [x: string]: RuleConfiguration; }; /** * Rule configuration. */ -type RuleConfiguration = any; +type RuleConfiguration = boolean | any; /** * Parses a configuration string and returns a configuration object. */ type ConfigurationParser = (text: string) => Configuration; /** - * Called with the result of the readConfig operation. + * Called with the result of the readConfig function. */ type ReadConfigCallback = (err: Error | null, config?: Configuration) => void; +/** + * Called with the result of the resolveConfigExtends function. + */ +type ResolveConfigExtendsCallback = (err: Error | null, path?: string) => void; /** * Lint specified Markdown files. * @@ -360,6 +375,7 @@ declare function markdownlintPromise(options: Options): Promise; * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -declare function readConfigPromise(file: string, parsers?: ConfigurationParser[]): Promise; +declare function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise; diff --git a/lib/markdownlint.js b/lib/markdownlint.js index f327364c..7f181142 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -2,7 +2,6 @@ "use strict"; -const fs = require("fs"); const path = require("path"); const { promisify } = require("util"); const markdownIt = require("markdown-it"); @@ -190,7 +189,7 @@ function annotateTokens(tokens, lines) { (token.type === "thead_open") || (token.type === "tbody_open") ) { - tableMap = token.map.slice(); + tableMap = [ ...token.map ]; } else if ( (token.type === "tr_close") && tableMap @@ -203,7 +202,7 @@ function annotateTokens(tokens, lines) { tableMap = null; } if (tableMap && !token.map) { - token.map = tableMap.slice(); + token.map = [ ...tableMap ]; } // Update token metadata if (token.map) { @@ -516,7 +515,8 @@ function lintContent( frontMatterLines }; cache.lineMetadata(helpers.getLineMetadata(params)); - cache.flattenedLists(helpers.flattenLists(params)); + cache.flattenedLists(helpers.flattenLists(params.tokens)); + cache.inlineCodeSpanRanges(helpers.inlineCodeSpanRanges(params.lines)); // Function to run for each rule const result = (resultVersion === 0) ? {} : []; // eslint-disable-next-line jsdoc/require-jsdoc @@ -684,6 +684,7 @@ function lintContent( * @param {boolean} handleRuleFailures Whether to handle exceptions in rules. * @param {boolean} noInlineConfig Whether to allow inline configuration. * @param {number} resultVersion Version of the LintResults object to return. + * @param {Object} fs File system implementation. * @param {boolean} synchronous Whether to execute synchronously. * @param {Function} callback Callback (err, result) function. * @returns {void} @@ -697,6 +698,7 @@ function lintFile( handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, callback) { // eslint-disable-next-line jsdoc/require-jsdoc @@ -709,7 +711,6 @@ function lintFile( } // Make a/synchronous call to read file if (synchronous) { - // @ts-ignore lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { fs.readFile(file, "utf8", lintContentWrapper); @@ -736,7 +737,7 @@ function lintInput(options, synchronous, callback) { } let files = []; if (Array.isArray(options.files)) { - files = options.files.slice(); + files = [ ...options.files ]; } else if (options.files) { files = [ String(options.files) ]; } @@ -755,6 +756,7 @@ function lintInput(options, synchronous, callback) { // @ts-ignore md.use(...plugin); }); + const fs = options.fs || require("fs"); const results = newResults(ruleList); let done = false; // Linting of strings is always synchronous @@ -794,6 +796,7 @@ function lintInput(options, synchronous, callback) { handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, syncCallback ); @@ -818,6 +821,7 @@ function lintInput(options, synchronous, callback) { handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, (err, result) => { concurrency--; @@ -928,17 +932,47 @@ function parseConfiguration(name, content, parsers) { * * @param {string} configFile Configuration file name. * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. + * @param {ResolveConfigExtendsCallback} [callback] Callback (err, result) + * function. + * @returns {void} + */ +function resolveConfigExtends(configFile, referenceId, fs, callback) { + const configFileDirname = path.dirname(configFile); + const resolvedExtendsFile = path.resolve(configFileDirname, referenceId); + fs.access(resolvedExtendsFile, (err) => { + if (err) { + // Not a file, try require.resolve + try { + return callback(null, dynamicRequire.resolve( + referenceId, + { "paths": [ configFileDirname ] } + )); + } catch { + // Unable to resolve, use resolvedExtendsFile + } + } + return callback(null, resolvedExtendsFile); + }); +} + +/** + * Resolve referenced "extends" path in a configuration file + * using path.resolve() with require.resolve() as a fallback. + * + * @param {string} configFile Configuration file name. + * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId) { +function resolveConfigExtendsSync(configFile, referenceId, fs) { const configFileDirname = path.dirname(configFile); const resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { - if (fs.statSync(resolvedExtendsFile).isFile()) { - return resolvedExtendsFile; - } + fs.accessSync(resolvedExtendsFile); + return resolvedExtendsFile; } catch { - // If not a file or fs.statSync throws, try require.resolve + // Not a file, try require.resolve } try { return dynamicRequire.resolve( @@ -946,7 +980,7 @@ function resolveConfigExtends(configFile, referenceId) { { "paths": [ configFileDirname ] } ); } catch { - // If require.resolve throws, return resolvedExtendsFile + // Unable to resolve, return resolvedExtendsFile } return resolvedExtendsFile; } @@ -957,14 +991,23 @@ function resolveConfigExtends(configFile, referenceId) { * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { +function readConfig(file, parsers, fs, callback) { if (!callback) { - // @ts-ignore - callback = parsers; - parsers = null; + if (fs) { + callback = fs; + fs = null; + } else { + // @ts-ignore + callback = parsers; + parsers = null; + } + } + if (!fs) { + fs = require("fs"); } // Read file fs.readFile(file, "utf8", (err, content) => { @@ -981,16 +1024,25 @@ function readConfig(file, parsers, callback) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends); - return readConfig(resolvedExtends, parsers, (errr, extendsConfig) => { - if (errr) { - return callback(errr); - } - return callback(null, { - ...extendsConfig, - ...config - }); - }); + return resolveConfigExtends( + file, + configExtends, + fs, + (_, resolvedExtends) => readConfig( + resolvedExtends, + parsers, + fs, + (errr, extendsConfig) => { + if (errr) { + return callback(errr); + } + return callback(null, { + ...extendsConfig, + ...config + }); + } + ) + ); } return callback(null, config); }); @@ -1003,11 +1055,12 @@ const readConfigPromisify = promisify && promisify(readConfig); * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfigPromise(file, parsers) { +function readConfigPromise(file, parsers, fs) { // @ts-ignore - return readConfigPromisify(file, parsers); + return readConfigPromisify(file, parsers, fs); } /** @@ -1015,11 +1068,15 @@ function readConfigPromise(file, parsers) { * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ -function readConfigSync(file, parsers) { +function readConfigSync(file, parsers, fs) { + if (!fs) { + fs = require("fs"); + } // Read file - // @ts-ignore const content = fs.readFileSync(file, "utf8"); // Try to parse file const { config, message } = parseConfiguration(file, content, parsers); @@ -1030,9 +1087,9 @@ function readConfigSync(file, parsers) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends); + const resolvedExtends = resolveConfigExtendsSync(file, configExtends, fs); return { - ...readConfigSync(resolvedExtends, parsers), + ...readConfigSync(resolvedExtends, parsers, fs), ...config }; } @@ -1155,6 +1212,7 @@ module.exports = markdownlint; * @property {boolean} [noInlineConfig] True to ignore HTML directives. * @property {number} [resultVersion] Results object version. * @property {Plugin[]} [markdownItPlugins] Additional plugins. + * @property {Object} [fs] File system implementation. */ /** @@ -1196,13 +1254,14 @@ module.exports = markdownlint; * Fix information. * * @typedef {Object} FixInfo + * @property {number} [lineNumber] Line number (1-based). * @property {number} [editColumn] Column of the fix (1-based). * @property {number} [deleteCount] Count of characters to delete. * @property {string} [insertText] Text to insert (after deleting). */ /** - * Called with the result of the lint operation. + * Called with the result of the lint function. * * @callback LintCallback * @param {Error | null} err Error object or null. @@ -1232,10 +1291,19 @@ module.exports = markdownlint; */ /** - * Called with the result of the readConfig operation. + * Called with the result of the readConfig function. * * @callback ReadConfigCallback * @param {Error | null} err Error object or null. * @param {Configuration} [config] Configuration object. * @returns {void} */ + +/** + * Called with the result of the resolveConfigExtends function. + * + * @callback ResolveConfigExtendsCallback + * @param {Error | null} err Error object or null. + * @param {string} [path] Resolved path to file. + * @returns {void} + */ diff --git a/lib/md010.js b/lib/md010.js index 5ebe08f8..de20f6cc 100644 --- a/lib/md010.js +++ b/lib/md010.js @@ -14,6 +14,10 @@ module.exports = { "function": function MD010(params, onError) { const codeBlocks = params.config.code_blocks; const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; + const spacesPerTab = params.config.spaces_per_tab; + const spaceMultiplier = (spacesPerTab === undefined) ? + 1 : + Math.max(0, Number(spacesPerTab)); forEachLine(lineMetadata(), (line, lineIndex, inCode) => { if (!inCode || includeCodeBlocks) { let match = null; @@ -29,7 +33,7 @@ module.exports = { { "editColumn": column, "deleteCount": length, - "insertText": "".padEnd(length) + "insertText": "".padEnd(length * spaceMultiplier) }); } } diff --git a/lib/md011.js b/lib/md011.js index 37941d17..0c906dc0 100644 --- a/lib/md011.js +++ b/lib/md011.js @@ -2,40 +2,44 @@ "use strict"; -const { addError, forEachInlineChild, unescapeMarkdown } = - require("../helpers"); +const { addError, forEachLine, overlapsAnyRange } = require("../helpers"); +const { inlineCodeSpanRanges, lineMetadata } = require("./cache"); -const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g; +const reversedLinkRe = + /(^|[^\\])\(([^)]+)\)\[([^\]^][^\]]*)](?!\()/g; module.exports = { "names": [ "MD011", "no-reversed-links" ], "description": "Reversed link syntax", "tags": [ "links" ], "function": function MD011(params, onError) { - forEachInlineChild(params, "text", (token) => { - const { lineNumber, content } = token; - let match = null; - while ((match = reversedLinkRe.exec(content)) !== null) { - const [ reversedLink, linkText, linkDestination ] = match; - const line = params.lines[lineNumber - 1]; - const column = unescapeMarkdown(line).indexOf(reversedLink) + 1; - const length = reversedLink.length; - const range = column ? [ column, length ] : null; - const fixInfo = column ? - { - "editColumn": column, - "deleteCount": length, - "insertText": `[${linkText}](${linkDestination})` - } : - null; - addError( - onError, - lineNumber, - reversedLink, - null, - range, - fixInfo - ); + const exclusions = inlineCodeSpanRanges(); + forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => { + if (!inCode && !onFence) { + let match = null; + while ((match = reversedLinkRe.exec(line)) !== null) { + const [ reversedLink, preChar, linkText, linkDestination ] = match; + const index = match.index + preChar.length; + const length = match[0].length - preChar.length; + if ( + !linkText.endsWith("\\") && + !linkDestination.endsWith("\\") && + !overlapsAnyRange(exclusions, lineIndex, index, length) + ) { + addError( + onError, + lineIndex + 1, + reversedLink.slice(preChar.length), + null, + [ index + 1, length ], + { + "editColumn": index + 1, + "deleteCount": length, + "insertText": `[${linkText}](${linkDestination})` + } + ); + } + } } }); } diff --git a/lib/md037.js b/lib/md037.js index 5d34afbf..14c5c032 100644 --- a/lib/md037.js +++ b/lib/md037.js @@ -78,11 +78,23 @@ module.exports = { lineMetadata(), (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) => { const onItemStart = (inItem === 1); - if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) { + if ( + inCode || + onFence || + inTable || + onBreak || + onItemStart || + isBlankLine(line) + ) { // Emphasis resets when leaving a block resetRunTracking(); } - if (inCode || onBreak || inMath) { + if ( + inCode || + onFence || + onBreak || + inMath + ) { // Emphasis has no meaning here return; } diff --git a/lib/md043.js b/lib/md043.js index e1945121..5805305b 100644 --- a/lib/md043.js +++ b/lib/md043.js @@ -28,8 +28,11 @@ module.exports = { const actual = levels[heading.tag] + " " + content; const expected = getExpected(); if (expected === "*") { - matchAny = true; - getExpected(); + const nextExpected = getExpected(); + if (nextExpected.toLowerCase() !== actual.toLowerCase()) { + matchAny = true; + i--; + } } else if (expected === "+") { matchAny = true; } else if (expected.toLowerCase() === actual.toLowerCase()) { @@ -43,9 +46,11 @@ module.exports = { } } }); + const extraHeadings = requiredHeadings.length - i; if ( !hasError && - (i < requiredHeadings.length) && + ((extraHeadings > 1) || + ((extraHeadings === 1) && (requiredHeadings[i] !== "*"))) && (anyHeadings || !requiredHeadings.every((heading) => heading === "*")) ) { addErrorContext(onError, params.lines.length, diff --git a/lib/md044.js b/lib/md044.js index 41778e8c..2d8da0e4 100644 --- a/lib/md044.js +++ b/lib/md044.js @@ -2,11 +2,9 @@ "use strict"; -const { addErrorDetailIf, bareUrlRe, escapeForRegExp, filterTokens, - forEachInlineChild, newLineRe } = require("../helpers"); - -const startNonWordRe = /^\W/; -const endNonWordRe = /\W$/; +const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, + overlapsAnyRange, linkRe, linkReferenceRe } = require("../helpers"); +const { inlineCodeSpanRanges, lineMetadata } = require("./cache"); module.exports = { "names": [ "MD044", "proper-names" ], @@ -15,80 +13,65 @@ module.exports = { "function": function MD044(params, onError) { let names = params.config.names; names = Array.isArray(names) ? names : []; + names.sort((a, b) => (b.length - a.length) || a.localeCompare(b)); const codeBlocks = params.config.code_blocks; const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; - // Text of automatic hyperlinks is implicitly a URL - const autolinkText = new Set(); - filterTokens(params, "inline", (token) => { - let inAutoLink = false; - token.children.forEach((child) => { - const { info, type } = child; - if ((type === "link_open") && (info === "auto")) { - inAutoLink = true; - } else if (type === "link_close") { - inAutoLink = false; - } else if ((type === "text") && inAutoLink) { - autolinkText.add(child); + const exclusions = []; + forEachLine(lineMetadata(), (line, lineIndex) => { + if (linkReferenceRe.test(line)) { + exclusions.push([ lineIndex, 0, line.length ]); + } else { + let match = null; + while ((match = bareUrlRe.exec(line)) !== null) { + exclusions.push([ lineIndex, match.index, match[0].length ]); + } + while ((match = linkRe.exec(line)) !== null) { + const [ , text, destination ] = match; + if (destination) { + exclusions.push( + [ lineIndex, match.index + text.length, destination.length ] + ); + } + } + } + }); + if (!includeCodeBlocks) { + exclusions.push(...inlineCodeSpanRanges()); + } + for (const name of names) { + const escapedName = escapeForRegExp(name); + const startNamePattern = /^\W/.test(name) ? "" : "\\b_*"; + const endNamePattern = /\W$/.test(name) ? "" : "_*\\b"; + const namePattern = + `(${startNamePattern})(${escapedName})${endNamePattern}`; + const nameRe = new RegExp(namePattern, "gi"); + forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => { + if (includeCodeBlocks || (!inCode && !onFence)) { + let match = null; + while ((match = nameRe.exec(line)) !== null) { + const [ , leftMatch, nameMatch ] = match; + const index = match.index + leftMatch.length; + const length = nameMatch.length; + if (!overlapsAnyRange(exclusions, lineIndex, index, length)) { + addErrorDetailIf( + onError, + lineIndex + 1, + name, + nameMatch, + null, + null, + [ index + 1, length ], + { + "editColumn": index + 1, + "deleteCount": length, + "insertText": name + } + ); + } + exclusions.push([ lineIndex, index, length ]); + } } }); - }); - // For each proper name... - names.forEach((name) => { - const escapedName = escapeForRegExp(name); - const startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b"; - const endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*"; - const namePattern = - `(${startNamePattern})(${escapedName})(${endNamePattern})`; - const anyNameRe = new RegExp(namePattern, "gi"); - // eslint-disable-next-line jsdoc/require-jsdoc - function forToken(token) { - if (!autolinkText.has(token)) { - const fenceOffset = (token.type === "fence") ? 1 : 0; - token.content.split(newLineRe).forEach((line, index) => { - let match = null; - while ((match = anyNameRe.exec(line)) !== null) { - const [ fullMatch, leftMatch, nameMatch, rightMatch ] = match; - if (fullMatch.search(bareUrlRe) === -1) { - const wordMatch = fullMatch - .replace(new RegExp(`^\\W{0,${leftMatch.length}}`), "") - .replace(new RegExp(`\\W{0,${rightMatch.length}}$`), ""); - if (!names.includes(wordMatch)) { - const lineNumber = token.lineNumber + index + fenceOffset; - const fullLine = params.lines[lineNumber - 1]; - const matchLength = wordMatch.length; - const matchIndex = fullLine.indexOf(wordMatch); - const range = (matchIndex === -1) ? - null : - [ matchIndex + 1, matchLength ]; - const fixInfo = (matchIndex === -1) ? - null : - { - "editColumn": matchIndex + 1, - "deleteCount": matchLength, - "insertText": name - }; - addErrorDetailIf( - onError, - lineNumber, - name, - nameMatch, - null, - null, - range, - fixInfo - ); - } - } - } - }); - } - } - forEachInlineChild(params, "text", forToken); - if (includeCodeBlocks) { - forEachInlineChild(params, "code_inline", forToken); - filterTokens(params, "code_block", forToken); - filterTokens(params, "fence", forToken); - } - }); + } } }; diff --git a/package.json b/package.json index ce4c4a6c..838a578c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "markdownlint", - "version": "0.23.1", + "version": "0.24.0", "description": "A Node.js style checker and lint tool for Markdown/CommonMark files.", "main": "lib/markdownlint.js", "types": "lib/markdownlint.d.ts", @@ -21,8 +21,16 @@ "build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2", "ci": "npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code", "clean-test-repos": "rimraf test-repos", - "clone-test-repos": "mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet", - "clone-test-repos-large": "npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet", + "clone-test-repos-dotnet-docs": "cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet", + "clone-test-repos-eslint-eslint": "cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet", + "clone-test-repos-mkdocs-mkdocs": "cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet", + "clone-test-repos-mochajs-mocha": "cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet", + "clone-test-repos-pi-hole-docs": "cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet", + "clone-test-repos-v8-v8-dev": "cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet", + "clone-test-repos-webhintio-hint": "cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet", + "clone-test-repos-webpack-webpack-js-org": "cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet", + "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org", + "clone-test-repos-large": "npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev", "declaration": "npm run build-declaration && npm run test-declaration", "example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint", "lint": "eslint --max-warnings 0 .", @@ -36,32 +44,32 @@ "node": ">=10" }, "dependencies": { - "markdown-it": "12.0.4" + "markdown-it": "12.2.0" }, "devDependencies": { "ava": "~3.15.0", - "c8": "~7.5.0", + "c8": "~7.8.0", "cpy-cli": "~3.1.1", - "eslint": "~7.19.0", - "eslint-plugin-jsdoc": "~31.6.0", + "eslint": "~7.32.0", + "eslint-plugin-jsdoc": "~36.0.7", "eslint-plugin-node": "~11.1.0", - "eslint-plugin-unicorn": "~27.0.0", - "globby": "~11.0.2", - "js-yaml": "~4.0.0", + "eslint-plugin-unicorn": "~35.0.0", + "globby": "~11.0.4", + "js-yaml": "~4.1.0", "markdown-it-for-inline": "~0.1.1", "markdown-it-sub": "~1.0.0", "markdown-it-sup": "~1.0.0", - "markdown-it-texmath": "~0.8.0", - "markdownlint-rule-helpers": "~0.13.0", + "markdown-it-texmath": "~0.9.1", + "markdownlint-rule-helpers": "~0.14.0", "npm-run-all": "~4.1.5", "rimraf": "~3.0.2", "strip-json-comments": "~3.1.1", "toml": "~3.0.0", - "ts-loader": "~8.0.15", + "ts-loader": "~9.2.5", "tv4": "~1.3.0", - "typescript": "~4.1.3", - "webpack": "~5.21.1", - "webpack-cli": "~4.5.0" + "typescript": "~4.3.5", + "webpack": "~5.51.1", + "webpack-cli": "~4.8.0" }, "keywords": [ "markdown", diff --git a/schema/.markdownlint.jsonc b/schema/.markdownlint.jsonc index 412af350..1f2493b1 100644 --- a/schema/.markdownlint.jsonc +++ b/schema/.markdownlint.jsonc @@ -55,7 +55,9 @@ // MD010/no-hard-tabs - Hard tabs "MD010": { // Include code blocks - "code_blocks": true + "code_blocks": true, + // Number of spaces for each hard tab + "spaces_per_tab": 1 }, // MD011/no-reversed-links - Reversed link syntax @@ -244,7 +246,7 @@ // MD048/code-fence-style - Code fence style "MD048": { - // Code fence syle + // Code fence style "style": "consistent" } } \ No newline at end of file diff --git a/schema/.markdownlint.yaml b/schema/.markdownlint.yaml index 5aaa9e46..ba61bef1 100644 --- a/schema/.markdownlint.yaml +++ b/schema/.markdownlint.yaml @@ -50,6 +50,8 @@ MD009: MD010: # Include code blocks code_blocks: true + # Number of spaces for each hard tab + spaces_per_tab: 1 # MD011/no-reversed-links - Reversed link syntax MD011: true @@ -221,5 +223,5 @@ MD047: true # MD048/code-fence-style - Code fence style MD048: - # Code fence syle + # Code fence style style: "consistent" \ No newline at end of file diff --git a/schema/build-config-schema.js b/schema/build-config-schema.js index 6e8ff95b..fbebe5af 100644 --- a/schema/build-config-schema.js +++ b/schema/build-config-schema.js @@ -32,7 +32,7 @@ const schema = { } }, "additionalProperties": { - "type:": [ + "type": [ "boolean", "object" ] @@ -135,6 +135,11 @@ rules.forEach(function forRule(rule) { "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }; break; @@ -380,7 +385,7 @@ rules.forEach(function forRule(rule) { case "MD048": scheme.properties = { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", diff --git a/schema/markdownlint-config-schema.json b/schema/markdownlint-config-schema.json index 20a4d094..a434e7cd 100644 --- a/schema/markdownlint-config-schema.json +++ b/schema/markdownlint-config-schema.json @@ -327,6 +327,11 @@ "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }, "additionalProperties": false @@ -343,6 +348,11 @@ "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }, "additionalProperties": false @@ -1396,7 +1406,7 @@ "default": true, "properties": { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", @@ -1417,7 +1427,7 @@ "default": true, "properties": { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", @@ -1551,7 +1561,7 @@ } }, "additionalProperties": { - "type:": [ + "type": [ "boolean", "object" ] diff --git a/test/detailed-results-4-tabs-MD010.json b/test/detailed-results-4-tabs-MD010.json new file mode 100644 index 00000000..2be47c1d --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.json @@ -0,0 +1,7 @@ +{ + "MD009": false, + "MD010": { + "spaces_per_tab": 4 + }, + "MD041": false +} diff --git a/test/detailed-results-4-tabs-MD010.md b/test/detailed-results-4-tabs-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-4-tabs-MD010.md.fixed b/test/detailed-results-4-tabs-MD010.md.fixed new file mode 100644 index 00000000..bd248107 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.md.fixed @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-4-tabs-MD010.results.json b/test/detailed-results-4-tabs-MD010.results.json new file mode 100644 index 00000000..9da12090 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.results.json @@ -0,0 +1,62 @@ +[ + { + "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": " " + } + }, + { + "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": " " + } + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": " " + } + } +] \ No newline at end of file diff --git a/test/detailed-results-MD001-MD010.results.json b/test/detailed-results-MD001-MD010.results.json index a821b7ce..7e4baf47 100644 --- a/test/detailed-results-MD001-MD010.results.json +++ b/test/detailed-results-MD001-MD010.results.json @@ -1,128 +1,255 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD001", "heading-increment", "header-increment" ], - "ruleDescription": "Heading levels should only increment by one level at a time", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md001", - "errorDetail": "Expected: h3; Actual: h4", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 1, - "ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ], - "ruleDescription": "First heading should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002", - "errorDetail": "Expected: h1; Actual: h2", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 5, - "ruleNames": [ "MD003", "heading-style", "header-style" ], - "ruleDescription": "Heading style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md003", - "errorDetail": "Expected: atx; Actual: atx_closed", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 10, - "ruleNames": [ "MD004", "ul-style" ], - "ruleDescription": "Unordered list style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md004", - "errorDetail": "Expected: asterisk; Actual: dash", - "errorContext": null, - "errorRange": [1, 2] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 23, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: 1; Actual: 0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: (3); Actual: (4)", - "errorContext": null, - "errorRange": [1, 5] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD006", "ul-start-left" ], - "ruleDescription": "Consider starting bulleted lists at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD006", "ul-start-left" ], - "ruleDescription": "Consider starting bulleted lists at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0 or 2; Actual: 1", - "errorContext": null, - "errorRange": [5, 1] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD010", "no-hard-tabs" ], - "ruleDescription": "Hard tabs", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "errorDetail": "Column: 5", - "errorContext": null, - "errorRange": [5, 1] + { + "lineNumber": 3, + "ruleNames": [ + "MD001", + "heading-increment", + "header-increment" + ], + "ruleDescription": "Heading levels should only increment by one level at a time", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md001", + "errorDetail": "Expected: h3; Actual: h4", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 1, + "ruleNames": [ + "MD002", + "first-heading-h1", + "first-header-h1" + ], + "ruleDescription": "First heading should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002", + "errorDetail": "Expected: h1; Actual: h2", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD003", + "heading-style", + "header-style" + ], + "ruleDescription": "Heading style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md003", + "errorDetail": "Expected: atx; Actual: atx_closed", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD004", + "ul-style" + ], + "ruleDescription": "Unordered list style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md004", + "errorDetail": "Expected: asterisk; Actual: dash", + "errorContext": null, + "errorRange": [ + 1, + 2 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "*" } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: 1; Actual: 0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 0, + "insertText": " " + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: (3); Actual: (4)", + "errorContext": null, + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD006", + "ul-start-left" + ], + "ruleDescription": "Consider starting bulleted lists at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "deleteCount": 1 + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD006", + "ul-start-left" + ], + "ruleDescription": "Consider starting bulleted lists at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "deleteCount": 1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0 or 2; Actual: 1", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1 + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD011-MD021.results.json b/test/detailed-results-MD011-MD021.results.json index 954d9ea7..f55d4358 100644 --- a/test/detailed-results-MD011-MD021.results.json +++ b/test/detailed-results-MD011-MD021.results.json @@ -1,110 +1,226 @@ [ - { - "lineNumber": 5, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(reversed)[link]", - "errorContext": null, - "errorRange": [3, 16] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(reversed)[link]", - "errorContext": null, - "errorRange": [11, 16] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD012", "no-multiple-blanks" ], - "ruleDescription": "Multiple consecutive blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md012", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 8, - "ruleNames": [ "MD013", "line-length" ], - "ruleDescription": "Line length", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", - "errorDetail": "Expected: 80; Actual: 99", - "errorContext": null, - "errorRange": [81, 19] - }, - { - "lineNumber": 10, - "ruleNames": [ "MD013", "line-length" ], - "ruleDescription": "Line length", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", - "errorDetail": "Expected: 40; Actual: 62", - "errorContext": null, - "errorRange": [41, 22] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD014", "commands-show-output" ], - "ruleDescription": "Dollar signs used before commands without showing output", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md014", - "errorDetail": null, - "errorContext": "$ command with no output", - "errorRange": [5, 2] - }, - { - "lineNumber": 14, - "ruleNames": [ "MD018", "no-missing-space-atx" ], - "ruleDescription": "No space after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018", - "errorDetail": null, - "errorContext": "##No space A", - "errorRange": [1, 3] - }, - { - "lineNumber": 16, - "ruleNames": [ "MD019", "no-multiple-space-atx" ], - "ruleDescription": "Multiple spaces after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md019", - "errorDetail": null, - "errorContext": "## Multiple spaces B", - "errorRange": [1, 5] - }, - { - "lineNumber": 18, - "ruleNames": [ "MD020", "no-missing-space-closed-atx" ], - "ruleDescription": "No space inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", - "errorDetail": null, - "errorContext": "##No space C ##", - "errorRange": [1, 3] - }, - { - "lineNumber": 20, - "ruleNames": [ "MD020", "no-missing-space-closed-atx" ], - "ruleDescription": "No space inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", - "errorDetail": null, - "errorContext": "## No space D##", - "errorRange": [13, 3] - }, - { - "lineNumber": 22, - "ruleNames": [ "MD021", "no-multiple-space-closed-atx" ], - "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", - "errorDetail": null, - "errorContext": "## Multiple spaces E ##", - "errorRange": [1, 5] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD021", "no-multiple-space-closed-atx" ], - "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", - "errorDetail": null, - "errorContext": "## Multiple spaces F ##", - "errorRange": [20, 5] + { + "lineNumber": 5, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(reversed)[link]", + "errorContext": null, + "errorRange": [ + 3, + 16 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 16, + "insertText": "[reversed](link)" } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(reversed)[link]", + "errorContext": null, + "errorRange": [ + 11, + 16 + ], + "fixInfo": { + "editColumn": 11, + "deleteCount": 16, + "insertText": "[reversed](link)" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD012", + "no-multiple-blanks" + ], + "ruleDescription": "Multiple consecutive blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md012", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": null, + "fixInfo": { + "deleteCount": -1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD013", + "line-length" + ], + "ruleDescription": "Line length", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", + "errorDetail": "Expected: 80; Actual: 99", + "errorContext": null, + "errorRange": [ + 81, + 19 + ], + "fixInfo": null + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD013", + "line-length" + ], + "ruleDescription": "Line length", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", + "errorDetail": "Expected: 40; Actual: 62", + "errorContext": null, + "errorRange": [ + 41, + 22 + ], + "fixInfo": null + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD014", + "commands-show-output" + ], + "ruleDescription": "Dollar signs used before commands without showing output", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md014", + "errorDetail": null, + "errorContext": "$ command with no output", + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2 + } + }, + { + "lineNumber": 14, + "ruleNames": [ + "MD018", + "no-missing-space-atx" + ], + "ruleDescription": "No space after hash on atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018", + "errorDetail": null, + "errorContext": "##No space A", + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 3, + "insertText": " " + } + }, + { + "lineNumber": 16, + "ruleNames": [ + "MD019", + "no-multiple-space-atx" + ], + "ruleDescription": "Multiple spaces after hash on atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md019", + "errorDetail": null, + "errorContext": "## Multiple spaces B", + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 1 + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD020", + "no-missing-space-closed-atx" + ], + "ruleDescription": "No space inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", + "errorDetail": null, + "errorContext": "##No space C ##", + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 15, + "insertText": "## No space C ##" + } + }, + { + "lineNumber": 20, + "ruleNames": [ + "MD020", + "no-missing-space-closed-atx" + ], + "ruleDescription": "No space inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", + "errorDetail": null, + "errorContext": "## No space D##", + "errorRange": [ + 13, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 15, + "insertText": "## No space D ##" + } + }, + { + "lineNumber": 22, + "ruleNames": [ + "MD021", + "no-multiple-space-closed-atx" + ], + "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", + "errorDetail": null, + "errorContext": "## Multiple spaces E ##", + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 24, + "insertText": "## Multiple spaces E ##" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD021", + "no-multiple-space-closed-atx" + ], + "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", + "errorDetail": null, + "errorContext": "## Multiple spaces F ##", + "errorRange": [ + 20, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 24, + "insertText": "## Multiple spaces F ##" + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD022-MD030.results.json b/test/detailed-results-MD022-MD030.results.json index ae3c3643..75bd0485 100644 --- a/test/detailed-results-MD022-MD030.results.json +++ b/test/detailed-results-MD022-MD030.results.json @@ -1,110 +1,211 @@ [ - { - "lineNumber": 1, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 1, - "ruleNames": [ "MD023", "heading-start-left", "header-start-left" ], - "ruleDescription": "Headings must start at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md023", - "errorDetail": null, - "errorContext": " # Heading", - "errorRange": [1, 2] - }, - { - "lineNumber": 4, - "ruleNames": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ], - "ruleDescription": "Multiple headings with the same content", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md024", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 4, - "ruleNames": [ "MD025", "single-title", "single-h1" ], - "ruleDescription": "Multiple top-level headings in the same document", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ "MD026", "no-trailing-punctuation" ], - "ruleDescription": "Trailing punctuation in heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md026", - "errorDetail": "Punctuation: '.'", - "errorContext": null, - "errorRange": [19, 1] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> Multiple spaces", - "errorRange": [1, 4] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > Multiple spaces, multiple...", - "errorRange": [ 1, 6 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > > Multiple spaces, multip...", - "errorRange": [ 1, 8 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > > Multiple spaces, multip...", - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 9, - "ruleNames": [ "MD028", "no-blanks-blockquote" ], - "ruleDescription": "Blank line inside blockquote", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md028", - "errorDetail": null, - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 2; Actual: 3; Style: 1/2/3", - "errorContext": null, - "errorRange": [1, 4] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 4] + { + "lineNumber": 1, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": { + "lineNumber": 2, + "insertText": "\n" } + }, + { + "lineNumber": 1, + "ruleNames": [ + "MD023", + "heading-start-left", + "header-start-left" + ], + "ruleDescription": "Headings must start at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md023", + "errorDetail": null, + "errorContext": " # Heading", + "errorRange": [ + 1, + 2 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1 + } + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD024", + "no-duplicate-heading", + "no-duplicate-header" + ], + "ruleDescription": "Multiple headings with the same content", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md024", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD025", + "single-title", + "single-h1" + ], + "ruleDescription": "Multiple top-level headings in the same document", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD026", + "no-trailing-punctuation" + ], + "ruleDescription": "Trailing punctuation in heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md026", + "errorDetail": "Punctuation: '.'", + "errorContext": null, + "errorRange": [ + 19, + 1 + ], + "fixInfo": { + "editColumn": 19, + "deleteCount": 1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> Multiple spaces", + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 1 + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > Multiple spaces, multiple...", + "errorRange": [ + 1, + 6 + ], + "fixInfo": { + "editColumn": 4, + "deleteCount": 1 + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > > Multiple spaces, multip...", + "errorRange": [ + 1, + 8 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 1 + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > > Multiple spaces, multip...", + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 1 + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD028", + "no-blanks-blockquote" + ], + "ruleDescription": "Blank line inside blockquote", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md028", + "errorDetail": null, + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 2; Actual: 3; Style: 1/2/3", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 2, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD030-warning-message.results.json b/test/detailed-results-MD030-warning-message.results.json index 178ff597..c775e2d8 100644 --- a/test/detailed-results-MD030-warning-message.results.json +++ b/test/detailed-results-MD030-warning-message.results.json @@ -1,20 +1,42 @@ [ - { - "lineNumber": 19, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 21, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 4] + { + "lineNumber": 19, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 2, + "insertText": " " } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 2, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD031-MD040.results.json b/test/detailed-results-MD031-MD040.results.json index 307040f3..24854df5 100644 --- a/test/detailed-results-MD031-MD040.results.json +++ b/test/detailed-results-MD031-MD040.results.json @@ -1,263 +1,585 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD031", "blanks-around-fences" ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```", - "errorRange": null - }, - { - "lineNumber": 4, - "ruleNames": [ "MD032", "blanks-around-lists" ], - "ruleDescription": "Lists should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", - "errorDetail": null, - "errorContext": "* List", - "errorRange": null - }, - { - "lineNumber": 47, - "ruleNames": [ "MD032", "blanks-around-lists" ], - "ruleDescription": "Lists should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", - "errorDetail": null, - "errorContext": "* List", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: hr", - "errorContext": null, - "errorRange": [ 7, 5 ] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ 6, 19 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD035", "hr-style" ], - "ruleDescription": "Horizontal rule style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md035", - "errorDetail": "Expected: ---; Actual: ***", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD036", "no-emphasis-as-heading", "no-emphasis-as-header" ], - "ruleDescription": "Emphasis used instead of a heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md036", - "errorDetail": null, - "errorContext": "Emphasis", - "errorRange": null - }, - { - "lineNumber": 15, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* inside *", - "errorRange": [ 7, 10 ] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* some*", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 32, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "*some *", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 33, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "**some **", - "errorRange": [ 17, 9 ] - }, - { - "lineNumber": 34, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "_ some_", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 35, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "__ some __", - "errorRange": [ 19, 10 ] - }, - { - "lineNumber": 62, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* inside", - "errorRange": [ 7, 8 ] - }, - { - "lineNumber": 63, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "multi-line *", - "errorRange": [ 1, 12 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` inside`", - "errorRange": [ 7, 9 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` inside``", - "errorRange": [ 7, 11 ] - }, - { - "lineNumber": 25, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` code`", - "errorRange": [ 19, 7 ] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` elements`", - "errorRange": [ 26, 11 ] - }, - { - "lineNumber": 27, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` code``", - "errorRange": [ 21, 9 ] - }, - { - "lineNumber": 28, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` ` embedded backtick``", - "errorRange": [ 1, 25 ] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "``embedded backtick` ``", - "errorRange": [ 1, 24 ] - }, - { - "lineNumber": 38, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` code", - "errorRange": [ 6, 6 ] - }, - { - "lineNumber": 44, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "span `", - "errorRange": [ 1, 7 ] - }, - { - "lineNumber": 53, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "span code ```", - "errorRange": [ 1, 13 ] - }, - { - "lineNumber": 55, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "```` code", - "errorRange": [ 11, 9 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ inside ]", - "errorRange": [ 7, 10 ] - }, - { - "lineNumber": 60, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ space]", - "errorRange": [ 6, 8 ] - }, - { - "lineNumber": 21, - "ruleNames": [ "MD040", "fenced-code-language" ], - "ruleDescription": "Fenced code blocks should have a language specified", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md040", - "errorDetail": null, - "errorContext": "```", - "errorRange": null + { + "lineNumber": 3, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": { + "lineNumber": 4, + "insertText": "\n" } + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD032", + "blanks-around-lists" + ], + "ruleDescription": "Lists should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", + "errorDetail": null, + "errorContext": "* List", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 47, + "ruleNames": [ + "MD032", + "blanks-around-lists" + ], + "ruleDescription": "Lists should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", + "errorDetail": null, + "errorContext": "* List", + "errorRange": null, + "fixInfo": { + "lineNumber": 48, + "insertText": "\n" + } + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: hr", + "errorContext": null, + "errorRange": [ + 7, + 5 + ], + "fixInfo": null + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 6, + 19 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 19, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD035", + "hr-style" + ], + "ruleDescription": "Horizontal rule style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md035", + "errorDetail": "Expected: ---; Actual: ***", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD036", + "no-emphasis-as-heading", + "no-emphasis-as-header" + ], + "ruleDescription": "Emphasis used instead of a heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md036", + "errorDetail": null, + "errorContext": "Emphasis", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* inside *", + "errorRange": [ + 7, + 10 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 10, + "insertText": "*inside*" + } + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* some*", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "*some*" + } + }, + { + "lineNumber": 32, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "*some *", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "*some*" + } + }, + { + "lineNumber": 33, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "**some **", + "errorRange": [ + 17, + 9 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 9, + "insertText": "**some**" + } + }, + { + "lineNumber": 34, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "_ some_", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "_some_" + } + }, + { + "lineNumber": 35, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "__ some __", + "errorRange": [ + 19, + 10 + ], + "fixInfo": { + "editColumn": 19, + "deleteCount": 10, + "insertText": "__some__" + } + }, + { + "lineNumber": 62, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* inside", + "errorRange": [ + 7, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 8, + "insertText": "*inside" + } + }, + { + "lineNumber": 63, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "multi-line *", + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "multi-line*" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` inside`", + "errorRange": [ + 7, + 9 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 7, + "insertText": "inside" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` inside``", + "errorRange": [ + 7, + 11 + ], + "fixInfo": { + "editColumn": 9, + "deleteCount": 7, + "insertText": "inside" + } + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` code`", + "errorRange": [ + 19, + 7 + ], + "fixInfo": { + "editColumn": 20, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` elements`", + "errorRange": [ + 26, + 11 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 9, + "insertText": "elements" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` code``", + "errorRange": [ + 21, + 9 + ], + "fixInfo": { + "editColumn": 23, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` ` embedded backtick``", + "errorRange": [ + 1, + 25 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 21, + "insertText": " ` embedded backtick" + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "``embedded backtick` ``", + "errorRange": [ + 1, + 24 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 20, + "insertText": "embedded backtick` " + } + }, + { + "lineNumber": 38, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` code", + "errorRange": [ + 6, + 6 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 44, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "span `", + "errorRange": [ + 1, + 7 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 6, + "insertText": "span" + } + }, + { + "lineNumber": 53, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "span code ```", + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 10, + "insertText": "span code" + } + }, + { + "lineNumber": 55, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "```` code", + "errorRange": [ + 11, + 9 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ inside ]", + "errorRange": [ + 7, + 10 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 8, + "insertText": "inside" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ space]", + "errorRange": [ + 6, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 6, + "insertText": "space" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[space ]", + "errorRange": [ + 26, + 8 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 6, + "insertText": "space" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ space ]", + "errorRange": [ + 46, + 9 + ], + "fixInfo": { + "editColumn": 47, + "deleteCount": 7, + "insertText": "space" + } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD040", + "fenced-code-language" + ], + "ruleDescription": "Fenced code blocks should have a language specified", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md040", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": null + } ] \ No newline at end of file diff --git a/test/detailed-results-MD041-MD050.results.json b/test/detailed-results-MD041-MD050.results.json index eccdb37e..70fa4e3a 100644 --- a/test/detailed-results-MD041-MD050.results.json +++ b/test/detailed-results-MD041-MD050.results.json @@ -1,119 +1,212 @@ [ - { - "lineNumber": 1, - "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], - "ruleDescription": "First line in a file should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", - "errorDetail": null, - "errorContext": "Not a heading", - "errorRange": null - }, - { - "lineNumber": 3, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 9] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 10] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 11] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty one]()", - "errorRange": [25, 13] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD043", "required-headings", "required-headers" ], - "ruleDescription": "Required heading structure", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md043", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 9, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: MARKDOWNLINT", - "errorContext": null, - "errorRange": [29, 12] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [7, 12] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: MarkDownLint", - "errorContext": null, - "errorRange": [1, 12] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD045", "no-alt-text" ], - "ruleDescription": "Images should have alternate text (alt text)", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md045", - "errorDetail": null, - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 25, - "ruleNames": [ "MD046", "code-block-style" ], - "ruleDescription": "Code block style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md046", - "errorDetail": "Expected: fenced; Actual: indented", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 31, - "ruleNames": [ "MD047", "single-trailing-newline" ], - "ruleDescription": "Files should end with a single newline character", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", - "errorDetail": null, - "errorContext": null, - "errorRange": [ 25, 1 ] - }, - { - "lineNumber": 27, - "ruleNames": [ "MD048", "code-fence-style" ], - "ruleDescription": "Code fence style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md048", - "errorDetail": "Expected: backtick; Actual: tilde", - "errorContext": null, - "errorRange": null + { + "lineNumber": 1, + "ruleNames": [ + "MD041", + "first-line-heading", + "first-line-h1" + ], + "ruleDescription": "First line in a file should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", + "errorDetail": null, + "errorContext": "Not a heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 10 + ], + "fixInfo": null + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 11 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty one]()", + "errorRange": [ + 25, + 13 + ], + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD043", + "required-headings", + "required-headers" + ], + "ruleDescription": "Required heading structure", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md043", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: MARKDOWNLINT", + "errorContext": null, + "errorRange": [ + 29, + 12 + ], + "fixInfo": { + "editColumn": 29, + "deleteCount": 12, + "insertText": "markdownlint" } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 7, + 12 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: MarkDownLint", + "errorContext": null, + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD045", + "no-alt-text" + ], + "ruleDescription": "Images should have alternate text (alt text)", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md045", + "errorDetail": null, + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD046", + "code-block-style" + ], + "ruleDescription": "Code block style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md046", + "errorDetail": "Expected: fenced; Actual: indented", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD047", + "single-trailing-newline" + ], + "ruleDescription": "Files should end with a single newline character", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", + "errorDetail": null, + "errorContext": null, + "errorRange": [ + 25, + 1 + ], + "fixInfo": { + "editColumn": 26, + "insertText": "\n" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD048", + "code-fence-style" + ], + "ruleDescription": "Code fence style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md048", + "errorDetail": "Expected: backtick; Actual: tilde", + "errorContext": null, + "errorRange": null, + "fixInfo": null + } ] \ No newline at end of file diff --git a/test/detailed-results-bare-urls.results.json b/test/detailed-results-bare-urls.results.json index a32f5355..ba50b122 100644 --- a/test/detailed-results-bare-urls.results.json +++ b/test/detailed-results-bare-urls.results.json @@ -1,92 +1,122 @@ [ - { - "lineNumber": 3, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 15, - 19 - ] - }, - { - "lineNumber": 5, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ - 15, - 20 - ] - }, - { - "lineNumber": 7, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/?query=str...", - "errorRange": [ - 15, - 38 - ] - }, - { - "lineNumber": 9, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/info.htm", - "errorRange": [ - 15, - 28 - ] - }, - { - "lineNumber": 11, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 7, - 19 - ] - }, - { - "lineNumber": 13, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 11, - 19 - ] + { + "lineNumber": 3, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 15, + 19 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 19, + "insertText": "" } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 15, + 20 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/?query=str...", + "errorRange": [ + 15, + 38 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 38, + "insertText": "" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/info.htm", + "errorRange": [ + 15, + 28 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 28, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 7, + 19 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 19, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 11, + 19 + ], + "fixInfo": { + "editColumn": 11, + "deleteCount": 19, + "insertText": "" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings-0-2.results.json b/test/detailed-results-blanks-around-headings-0-2.results.json index 87b29b82..78e6c12e 100644 --- a/test/detailed-results-blanks-around-headings-0-2.results.json +++ b/test/detailed-results-blanks-around-headings-0-2.results.json @@ -1,20 +1,36 @@ [ - { - "lineNumber": 8, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 2; Actual: 1; Below", - "errorContext": "## Banana", - "errorRange": null - }, - { - "lineNumber": 21, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 2; Actual: 0; Below", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 8, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 2; Actual: 1; Below", + "errorContext": "## Banana", + "errorRange": null, + "fixInfo": { + "lineNumber": 9, + "insertText": "\n" } -] + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 2; Actual: 0; Below", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "lineNumber": 23, + "insertText": "\n\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings-3-0.results.json b/test/detailed-results-blanks-around-headings-3-0.results.json index 7c558c18..5264c149 100644 --- a/test/detailed-results-blanks-around-headings-3-0.results.json +++ b/test/detailed-results-blanks-around-headings-3-0.results.json @@ -1,20 +1,34 @@ [ - { - "lineNumber": 19, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 3; Actual: 2; Above", - "errorContext": "## Durian ##", - "errorRange": null - }, - { - "lineNumber": 22, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 3; Actual: 1; Above", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 19, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 3; Actual: 2; Above", + "errorContext": "## Durian ##", + "errorRange": null, + "fixInfo": { + "insertText": "\n" } -] + }, + { + "lineNumber": 22, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 3; Actual: 1; Above", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "insertText": "\n\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings.results.json b/test/detailed-results-blanks-around-headings.results.json index ccaf5225..e006d0ed 100644 --- a/test/detailed-results-blanks-around-headings.results.json +++ b/test/detailed-results-blanks-around-headings.results.json @@ -1,29 +1,68 @@ [ - { - "lineNumber": 7, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "## Banana", - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "## Durian ##", - "errorRange": null - }, - { - "lineNumber": 18, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 7, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "## Banana", + "errorRange": null, + "fixInfo": { + "lineNumber": 8, + "insertText": "\n" } -] + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "## Durian ##", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "lineNumber": 20, + "insertText": "\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-code-fences-in-blockquotes.results.json b/test/detailed-results-code-fences-in-blockquotes.results.json index b8011391..77619e6e 100644 --- a/test/detailed-results-code-fences-in-blockquotes.results.json +++ b/test/detailed-results-code-fences-in-blockquotes.results.json @@ -1,74 +1,98 @@ [ - { - "lineNumber": 4, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```markdown", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```", - "errorRange": null - }, - { - "lineNumber": 10, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> ```markdown", - "errorRange": null - }, - { - "lineNumber": 12, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> ```", - "errorRange": null - }, - { - "lineNumber": 15, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> > ```markdown", - "errorRange": null - }, - { - "lineNumber": 17, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> > ```", - "errorRange": null + { + "lineNumber": 4, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 4, + "insertText": "\n" } -] + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": { + "lineNumber": 7, + "insertText": "\n" + } + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> ```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 10, + "insertText": ">\n" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> ```", + "errorRange": null, + "fixInfo": { + "lineNumber": 13, + "insertText": ">\n" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> > ```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 15, + "insertText": "> >\n" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> > ```", + "errorRange": null, + "fixInfo": { + "lineNumber": 18, + "insertText": "> >\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-default-spaces-MD010.json b/test/detailed-results-default-spaces-MD010.json new file mode 100644 index 00000000..72db1d34 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.json @@ -0,0 +1,4 @@ +{ + "MD009": false, + "MD041": false +} diff --git a/test/detailed-results-default-spaces-MD010.md b/test/detailed-results-default-spaces-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-default-spaces-MD010.md.fixed b/test/detailed-results-default-spaces-MD010.md.fixed new file mode 100644 index 00000000..b7f7ff9c --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.md.fixed @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-default-spaces-MD010.results.json b/test/detailed-results-default-spaces-MD010.results.json new file mode 100644 index 00000000..c3e627a9 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.results.json @@ -0,0 +1,62 @@ +[ + { + "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": " " + } + }, + { + "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": " " + } + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": " " + } + } +] \ No newline at end of file diff --git a/test/detailed-results-fixing-with-front-matter.results.json b/test/detailed-results-fixing-with-front-matter.results.json index 9a376aa9..dc102923 100644 --- a/test/detailed-results-fixing-with-front-matter.results.json +++ b/test/detailed-results-fixing-with-front-matter.results.json @@ -1,47 +1,93 @@ [ - { - "lineNumber": 6, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0 or 2; Actual: 3", - "errorContext": null, - "errorRange": [ 15, 3 ] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "# Fixing with Front Matter", - "errorRange": null - }, - { - "lineNumber": 9, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "## Nested Heading", - "errorRange": null - }, - { - "lineNumber": 8, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ link ]", - "errorRange": [ 6, 8 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD047", "single-trailing-newline" ], - "ruleDescription": "Files should end with a single newline character", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", - "errorDetail": null, - "errorContext": null, - "errorRange": [ 4, 1 ] + { + "lineNumber": 6, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0 or 2; Actual: 3", + "errorContext": null, + "errorRange": [ + 15, + 3 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 3 } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "# Fixing with Front Matter", + "errorRange": null, + "fixInfo": { + "lineNumber": 6, + "insertText": "\n" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "## Nested Heading", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ link ]", + "errorRange": [ + 6, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 6, + "insertText": "link" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD047", + "single-trailing-newline" + ], + "ruleDescription": "Files should end with a single newline character", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", + "errorDetail": null, + "errorContext": null, + "errorRange": [ + 4, + 1 + ], + "fixInfo": { + "editColumn": 5, + "insertText": "\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-front-matter.results.json b/test/detailed-results-front-matter.results.json index 4f343481..3b96c35b 100644 --- a/test/detailed-results-front-matter.results.json +++ b/test/detailed-results-front-matter.results.json @@ -1,20 +1,35 @@ [ - { - "lineNumber": 6, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [5, 1] - }, - { - "lineNumber": 4, - "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], - "ruleDescription": "First line in a file should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", - "errorDetail": null, - "errorContext": "Text", - "errorRange": null + { + "lineNumber": 6, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1 } -] + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD041", + "first-line-heading", + "first-line-h1" + ], + "ruleDescription": "First line in a file should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", + "errorDetail": null, + "errorContext": "Text", + "errorRange": null, + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-html-tags.results.json b/test/detailed-results-html-tags.results.json index bef47797..3c4366eb 100644 --- a/test/detailed-results-html-tags.results.json +++ b/test/detailed-results-html-tags.results.json @@ -1,173 +1,322 @@ [ - { - "lineNumber": 5, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: p", - "errorContext": null, - "errorRange": [ 1, 3 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 7, 4 ] - }, - { - "lineNumber": 23, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 7, 4 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 36, 4 ] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 9, 4 ] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 14, 4 ] - }, - { - "lineNumber": 35, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 37, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 41, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 43, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 35, 4 ] - }, - { - "lineNumber": 49, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: problem", - "errorContext": null, - "errorRange": [ 3, 9 ] - }, - { - "lineNumber": 55, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: problem", - "errorContext": null, - "errorRange": [ 8, 9 ] - }, - { - "lineNumber": 61, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 8, 4 ] - }, - { - "lineNumber": 84, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 18, 4 ] - }, - { - "lineNumber": 90, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: a", - "errorContext": null, - "errorRange": [ 6, 18 ] - }, - { - "lineNumber": 91, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: img", - "errorContext": null, - "errorRange": [ 6, 20 ] - }, - { - "lineNumber": 101, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: foo-bar-baz", - "errorContext": null, - "errorRange": [ 1, 13 ] - } -] + { + "lineNumber": 5, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: p", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 36, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 9, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 14, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 35, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 37, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 41, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 41, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 56, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 43, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 35, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 49, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: problem", + "errorContext": null, + "errorRange": [ + 3, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 55, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: problem", + "errorContext": null, + "errorRange": [ + 8, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 61, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 84, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 18, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 90, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: a", + "errorContext": null, + "errorRange": [ + 6, + 18 + ], + "fixInfo": null + }, + { + "lineNumber": 91, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: img", + "errorContext": null, + "errorRange": [ + 6, + 20 + ], + "fixInfo": null + }, + { + "lineNumber": 101, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: foo-bar-baz", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-links.results.json b/test/detailed-results-links.results.json index 9c173032..9d6c721a 100644 --- a/test/detailed-results-links.results.json +++ b/test/detailed-results-links.results.json @@ -1,110 +1,275 @@ [ - { - "lineNumber": 30, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(Incorrect link syntax)[https://www.example.com/]", - "errorContext": null, - "errorRange": [ 1, 49 ] - }, - { - "lineNumber": 3, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ 6, 20 ] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 42, 24 ] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 6, 24 ] - }, - { - "lineNumber": 9, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ 48, 20 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 44, 24 ] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/dir", - "errorRange": [ 6, 23 ] - }, - { - "lineNumber": 14, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/file.txt", - "errorRange": [ 6, 28 ] - }, - { - "lineNumber": 16, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/dir/dir/fi...", - "errorRange": [ 6, 44 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/same", - "errorRange": [ 43, 24 ] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/same", - "errorRange": null - }, - { - "lineNumber": 28, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/first", - "errorRange": [ 6, 25 ] + { + "lineNumber": 30, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(Incorrect link syntax)[https://www.example.com/]", + "errorContext": null, + "errorRange": [ + 1, + 49 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 49, + "insertText": "[Incorrect link syntax](https://www.example.com/)" } -] + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 6, + 20 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 42, + 24 + ], + "fixInfo": { + "editColumn": 42, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 6, + 24 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 48, + 20 + ], + "fixInfo": { + "editColumn": 48, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 44, + 24 + ], + "fixInfo": { + "editColumn": 44, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/dir", + "errorRange": [ + 6, + 23 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 23, + "insertText": "" + } + }, + { + "lineNumber": 14, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/file.txt", + "errorRange": [ + 6, + 28 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 28, + "insertText": "" + } + }, + { + "lineNumber": 16, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/dir/dir/fi...", + "errorRange": [ + 6, + 44 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 44, + "insertText": "" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/same", + "errorRange": [ + 43, + 24 + ], + "fixInfo": { + "editColumn": 43, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/same", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/first", + "errorRange": [ + 6, + 25 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 25, + "insertText": "" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/second", + "errorRange": [ + 42, + 26 + ], + "fixInfo": { + "editColumn": 42, + "deleteCount": 26, + "insertText": "" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/third", + "errorRange": [ + 85, + 25 + ], + "fixInfo": { + "editColumn": 85, + "deleteCount": 25, + "insertText": "" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-no-tabs-edge-case-MD010.json b/test/detailed-results-no-tabs-edge-case-MD010.json new file mode 100644 index 00000000..3c4b4177 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.json @@ -0,0 +1,7 @@ +{ + "MD009": false, + "MD010": { + "spaces_per_tab": 0 + }, + "MD041": false +} diff --git a/test/detailed-results-no-tabs-edge-case-MD010.md b/test/detailed-results-no-tabs-edge-case-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-no-tabs-edge-case-MD010.md.fixed b/test/detailed-results-no-tabs-edge-case-MD010.md.fixed new file mode 100644 index 00000000..f58b2f71 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.md.fixed @@ -0,0 +1,3 @@ +text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-no-tabs-edge-case-MD010.results.json b/test/detailed-results-no-tabs-edge-case-MD010.results.json new file mode 100644 index 00000000..a6a8cfbd --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.results.json @@ -0,0 +1,62 @@ +[ + { + "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": "" + } + }, + { + "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": "" + } + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": "" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-ordered-list-item-prefix-single.results.json b/test/detailed-results-ordered-list-item-prefix-single.results.json index e2c5d51c..f6052b30 100644 --- a/test/detailed-results-ordered-list-item-prefix-single.results.json +++ b/test/detailed-results-ordered-list-item-prefix-single.results.json @@ -1,11 +1,18 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 1; Actual: 9; Style: 1/1/1", - "errorContext": null, - "errorRange": [1, 3] - } -] + { + "lineNumber": 3, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 1; Actual: 9; Style: 1/1/1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-ordered-list-item-prefix-zero.results.json b/test/detailed-results-ordered-list-item-prefix-zero.results.json index 79fafa14..08999c00 100644 --- a/test/detailed-results-ordered-list-item-prefix-zero.results.json +++ b/test/detailed-results-ordered-list-item-prefix-zero.results.json @@ -1,56 +1,98 @@ [ - { - "lineNumber": 11, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 18, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 2; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 3; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - } -] + { + "lineNumber": 11, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 2; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 3; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-proper-names.results.json b/test/detailed-results-proper-names.results.json index 59939884..3212c0d8 100644 --- a/test/detailed-results-proper-names.results.json +++ b/test/detailed-results-proper-names.results.json @@ -1,242 +1,322 @@ [ - { - "lineNumber": 3, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 6, - 12 - ] - }, - { - "lineNumber": 5, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 6, - 7 - ] - }, - { - "lineNumber": 7, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 6, - 4 - ] - }, - { - "lineNumber": 9, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 13, - 4 - ] - }, - { - "lineNumber": 11, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 7, - 12 - ] - }, - { - "lineNumber": 13, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 7, - 7 - ] - }, - { - "lineNumber": 15, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 7, - 4 - ] - }, - { - "lineNumber": 17, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 14, - 4 - ] - }, - { - "lineNumber": 19, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 8, - 12 - ] - }, - { - "lineNumber": 21, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 8, - 7 - ] - }, - { - "lineNumber": 23, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 8, - 4 - ] - }, - { - "lineNumber": 25, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 15, - 4 - ] - }, - { - "lineNumber": 27, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 1, - 12 - ] - }, - { - "lineNumber": 29, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 1, - 7 - ] - }, - { - "lineNumber": 31, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 1, - 4 - ] - }, - { - "lineNumber": 33, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 8, - 4 - ] + { + "lineNumber": 3, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 6, + 12 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 12, + "insertText": "markdownlint" } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 6, + 7 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 13, + 4 + ], + "fixInfo": { + "editColumn": 13, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 7, + 12 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 7, + 7 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 14, + 4 + ], + "fixInfo": { + "editColumn": 14, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 8, + 12 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 8, + 7 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 15, + 4 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 1, + 7 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 33, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 4, + "insertText": ".NET" + } + } +] \ No newline at end of file diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index 14bc3618..02327e39 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -54,6 +54,8 @@ function lintTestRepo(t, globPatterns, configPath) { files, config }; + // eslint-disable-next-line no-console + console.log(`${t.title}: Linting ${files.length} files...`); return markdownlintPromise(options).then((results) => { const resultsString = results.toString(); if (resultsString.length > 0) { @@ -79,13 +81,27 @@ test("https://github.com/mkdocs/mkdocs", (t) => { const globPatterns = [ join(rootDir, "README.md"), join(rootDir, "CONTRIBUTING.md"), - join(rootDir, "docs/*"), + join(rootDir, "docs/**/*.md"), "!" + join(rootDir, "docs/CNAME") ]; const configPath = join(rootDir, ".markdownlintrc"); return lintTestRepo(t, globPatterns, configPath); }); +test("https://github.com/mochajs/mocha", (t) => { + const rootDir = "./test-repos/mochajs-mocha"; + const globPatterns = [ + join(rootDir, "*.md"), + join(rootDir, "docs/**/*.md"), + join(rootDir, ".github/*.md"), + join(rootDir, "lib/**/*.md"), + join(rootDir, "test/**/*.md"), + join(rootDir, "example/**/*.md") + ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); +}); + test("https://github.com/pi-hole/docs", (t) => { const rootDir = "./test-repos/pi-hole-docs"; const globPatterns = [ join(rootDir, "**/*.md") ]; @@ -93,6 +109,23 @@ test("https://github.com/pi-hole/docs", (t) => { return lintTestRepo(t, globPatterns, configPath); }); +test("https://github.com/webhintio/hint", (t) => { + const rootDir = "./test-repos/webhintio-hint"; + const globPatterns = [ + join(rootDir, "**/*.md"), + "!" + join(rootDir, "**/CHANGELOG.md") + ]; + const configPath = join(rootDir, ".markdownlintrc"); + return lintTestRepo(t, globPatterns, configPath); +}); + +test("https://github.com/webpack/webpack.js.org", (t) => { + const rootDir = "./test-repos/webpack-webpack-js-org"; + const globPatterns = [ join(rootDir, "**/*.md") ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); +}); + // Optional repositories (very large) const dotnetDocsDir = "./test-repos/dotnet-docs"; @@ -101,15 +134,19 @@ if (existsSync(dotnetDocsDir)) { const rootDir = dotnetDocsDir; const globPatterns = [ join(rootDir, "**/*.md"), - "!" + join(rootDir, "samples/**/*.md"), - // A table parsing change in markdown-it v12 causes a new issue here - "!" + join( - rootDir, - "docs/standard/base-types/" + - "regular-expression-example-scanning-for-hrefs.md" - ) + "!" + join(rootDir, "samples/**/*.md") ]; const configPath = join(rootDir, ".markdownlint.json"); return lintTestRepo(t, globPatterns, configPath); }); } + +const v8v8DevDir = "./test-repos/v8-v8-dev"; +if (existsSync(v8v8DevDir)) { + test("https://github.com/v8/v8.dev", (t) => { + const rootDir = v8v8DevDir; + const globPatterns = [ join(rootDir, "src/**/*.md") ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); + }); +} diff --git a/test/markdownlint-test-scenarios.js b/test/markdownlint-test-scenarios.js index 98beeaba..64a71754 100644 --- a/test/markdownlint-test-scenarios.js +++ b/test/markdownlint-test-scenarios.js @@ -29,6 +29,7 @@ function createTestForFile(file) { .then( function configFileExists() { return fs.promises.readFile(configFile, "utf8") + // @ts-ignore .then(JSON.parse); }, function noConfigFile() { @@ -44,7 +45,7 @@ function createTestForFile(file) { return markdownlintPromise({ "files": [ file ], config, - "resultVersion": detailedResults ? 2 : 3 + "resultVersion": 3 }); }) .then( diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 5193a7a3..b3956673 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -80,6 +80,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md", "CONTRIBUTING.md", "doc/CustomRules.md", + "doc/Prettier.md", "helpers/README.md" ], "noInlineConfig": true, @@ -94,6 +95,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md": [], "CONTRIBUTING.md": [], "doc/CustomRules.md": [], + "doc/Prettier.md": [], "helpers/README.md": [] }; t.deepEqual(actual, expected, "Issue(s) with project files."); @@ -652,11 +654,13 @@ test.cb("readmeHeadings", (t) => { "##### options.noInlineConfig", "##### options.resultVersion", "##### options.markdownItPlugins", + "##### options.fs", "#### callback", "#### result", "### Config", "#### file", "#### parsers", + "#### fs", "#### callback", "#### result", "## Usage", @@ -681,7 +685,7 @@ test.cb("filesArrayNotModified", (t) => { "./test/atx_heading_spacing.md", "./test/first_heading_bad_atx.md" ]; - const expectedFiles = files.slice(); + const expectedFiles = [ ...files ]; markdownlint({ "files": files }, function callback(err) { t.falsy(err); t.deepEqual(files, expectedFiles, "Files modified."); @@ -798,6 +802,40 @@ test.cb("missingStringValue", (t) => { }); }); +test("customFileSystemSync", (t) => { + t.plan(2); + const file = "/dir/file.md"; + const fsApi = { + "readFileSync": (p) => { + t.is(p, file); + return "# Heading"; + } + }; + const result = markdownlint.sync({ + "files": file, + "fs": fsApi + }); + t.deepEqual(result[file].length, 1, "Did not report violations."); +}); + +test.cb("customFileSystemAsync", (t) => { + t.plan(3); + const file = "/dir/file.md"; + const fsApi = { + "readFile": (p, o, cb) => { + t.is(p, file); + cb(null, "# Heading"); + } + }; + markdownlint({ + "files": file, + "fs": fsApi + }, function callback(err, result) { + t.falsy(err); + t.deepEqual(result[file].length, 1, "Did not report violations."); + t.end(); + }); +}); test.cb("readme", (t) => { t.plan(115); const tagToRules = {}; @@ -811,12 +849,13 @@ test.cb("readme", (t) => { fs.readFile("README.md", "utf8", function readFile(err, contents) { t.falsy(err); - const rulesLeft = rules.slice(); + const rulesLeft = [ ...rules ]; let seenRelated = false; let seenRules = false; let inRules = false; let seenTags = false; let inTags = false; + // @ts-ignore md.parse(contents, {}).forEach(function forToken(token) { if ( (token.type === "bullet_list_open") && @@ -878,7 +917,7 @@ test.cb("rules", (t) => { fs.readFile("doc/Rules.md", "utf8", (err, contents) => { t.falsy(err); - const rulesLeft = rules.slice(); + const rulesLeft = [ ...rules ]; let inHeading = false; let rule = null; let ruleHasTags = true; @@ -896,6 +935,7 @@ test.cb("rules", (t) => { t.true(!ruleUsesParams, "Missing parameters for rule " + r.names + "."); }; + // @ts-ignore md.parse(contents, {}).forEach(function forToken(token) { if ((token.type === "heading_open") && (token.tag === "h2")) { inHeading = true; @@ -1008,6 +1048,22 @@ test("validateConfigSchemaAllowsUnknownProperties", (t) => { }); }); +test("validateConfigSchemaAppliesToUnknownProperties", (t) => { + t.plan(4); + for (const allowed of [ true, {} ]) { + t.true( + // @ts-ignore + tv4.validate({ "property": allowed }, configSchema), + `Unknown property value ${allowed} blocked`); + } + for (const blocked of [ 2, "string" ]) { + t.false( + // @ts-ignore + tv4.validate({ "property": blocked }, configSchema), + `Unknown property value ${blocked} allowed`); + } +}); + test("validateConfigExampleJson", (t) => { t.plan(2); @@ -1087,6 +1143,53 @@ test.cb("configMultipleWithRequireResolve", (t) => { }); }); +test.cb("configCustomFileSystem", (t) => { + t.plan(5); + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "access": (p, m, cb) => { + t.is(p, extended); + return (cb || m)(); + }, + "readFile": (p, o, cb) => { + switch (p) { + case file: + t.is(p, file); + return cb(null, JSON.stringify(fileContent)); + case extended: + t.is(p, extended); + return cb(null, JSON.stringify(extendedContent)); + default: + return t.fail(); + } + } + }; + markdownlint.readConfig( + file, + null, + fsApi, + function callback(err, actual) { + t.falsy(err); + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); + t.end(); + }); +}); + test.cb("configBadFile", (t) => { t.plan(4); markdownlint.readConfig("./test/config/config-badfile.json", @@ -1340,6 +1443,45 @@ test("configMultipleHybridSync", (t) => { t.like(actual, expected, "Config object not correct."); }); +test("configCustomFileSystemSync", (t) => { + t.plan(4); + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "accessSync": (p) => { + t.is(p, extended); + }, + "readFileSync": (p) => { + switch (p) { + case file: + t.is(p, file); + return JSON.stringify(fileContent); + case extended: + t.is(p, extended); + return JSON.stringify(extendedContent); + default: + return t.fail(); + } + } + }; + const actual = markdownlint.readConfigSync(file, null, fsApi); + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); +}); + test("configBadHybridSync", (t) => { t.plan(1); t.throws( @@ -1367,6 +1509,49 @@ test.cb("configSinglePromise", (t) => { }); }); +test.cb("configCustomFileSystemPromise", (t) => { + t.plan(4); + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "access": (p, m, cb) => { + t.is(p, extended); + return (cb || m)(); + }, + "readFile": (p, o, cb) => { + switch (p) { + case file: + t.is(p, file); + return cb(null, JSON.stringify(fileContent)); + case extended: + t.is(p, extended); + return cb(null, JSON.stringify(extendedContent)); + default: + return t.fail(); + } + } + }; + markdownlint.promises.readConfig(file, null, fsApi) + .then((actual) => { + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); + t.end(); + }); +}); + test.cb("configBadFilePromise", (t) => { t.plan(2); markdownlint.promises.readConfig("./test/config/config-badfile.json") diff --git a/test/proper-names-links.md b/test/proper-names-links.md new file mode 100644 index 00000000..46d42a62 --- /dev/null +++ b/test/proper-names-links.md @@ -0,0 +1,43 @@ +# Proper names in links + +javascript {MD044} + +Learn about JavaScript here: https://example.com/javascript/about + +Learn about JavaScript here: + +Learn about [JavaScript](https://example.com/javascript/about). + +Learn about [JavaScript](wiki/javascript/about). + +Learn about [JavaScript](wiki/javascript). + +Learn about [JavaScript](javascript/about). + +Learn about [JavaScript](javascript). + +Learn about [JavaScript][js]. + +Learn about [JavaScript][example-js]. + +Learn about [JavaScript][javascript]. + +Learn about [javascript][js]. {MD044} + +Learn about [javascript][example-js]. {MD044} + +Learn about [javascript]. {MD044} + +[js]: https://example.com/javascript/about + [example-js]: javascript + [javascript]: https://example.com/js + [javascript]: https://example.com/js {MD044} + + diff --git a/test/proper-names-no-code.md b/test/proper-names-no-code.md index 66a0dc3a..488738d0 100644 --- a/test/proper-names-no-code.md +++ b/test/proper-names-no-code.md @@ -22,4 +22,22 @@ node.js is runtime A short paragraph about node.js and {MD044} -javascript. {MD044} +also javascript. {MD044} + +`javascript` + +`code +javascript` + +`code +javascript +code` + +`javascript +code` + +text JavaScript text `javascript` text JavaScript text +text `javascript` text JavaScript text `javascript` text + +text javascript text `javascript` text {MD044} +text `javascript` text javascript text {MD044} diff --git a/test/proper-names-projects.json b/test/proper-names-projects.json index 5b6fbc7f..71daf346 100644 --- a/test/proper-names-projects.json +++ b/test/proper-names-projects.json @@ -6,7 +6,6 @@ "github.com", "github.com/about", "npm", - "NPM", "Vue", "Vuex", "vue-router" diff --git a/test/proper-names-projects.md b/test/proper-names-projects.md index 6e304bf2..0360e14c 100644 --- a/test/proper-names-projects.md +++ b/test/proper-names-projects.md @@ -32,14 +32,16 @@ The library vue-router Not Vue-router {MD044} -Or vue-router-extra {MD044} +But vue-router-extra is different -Or extra-vue-router {MD044} +As is extra-vue-router Quoted "Vue" and "vue-router" Emphasized *Vue* and *vue-router* +Underscored _Vue_ and _vue-router_ + Call it npm -Or NPM But not Npm {MD044} +Or NPM {MD044} diff --git a/test/proper-names-substrings.md b/test/proper-names-substrings.md new file mode 100644 index 00000000..fb737616 --- /dev/null +++ b/test/proper-names-substrings.md @@ -0,0 +1,15 @@ +# Proper Names as Substrings + +The proper case is: @aws-control-tower + +Similarly, aws-vault and AWS and @aws-control-tower are all correct. + + diff --git a/test/proper-names.md b/test/proper-names.md index b4ca9f03..57f5a7c2 100644 --- a/test/proper-names.md +++ b/test/proper-names.md @@ -72,12 +72,12 @@ javascript. {MD044} {MD044} `javascript` -{MD044} `code -javascript` +`code +javascript` {MD044} -{MD044} `code -javascript +`code +javascript {MD044} code` -{MD044} `javascript +`javascript {MD044} code` diff --git a/test/required-headings-missing-last-zero-or-more.json b/test/required-headings-missing-last-zero-or-more.json new file mode 100644 index 00000000..2bb3e509 --- /dev/null +++ b/test/required-headings-missing-last-zero-or-more.json @@ -0,0 +1,14 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "*", + "### Three", + "*", + "### Five", + "*", + "#### FOO" + ] + } +} diff --git a/test/required-headings-missing-last-zero-or-more.md b/test/required-headings-missing-last-zero-or-more.md new file mode 100644 index 00000000..6a95d2e4 --- /dev/null +++ b/test/required-headings-missing-last-zero-or-more.md @@ -0,0 +1,15 @@ +# One + +## Two + +### THREE + +## four + +## Five + +### SiX + +#### FOO + +{MD043:16} diff --git a/test/required-headings-missing-middle-zero-or-more.json b/test/required-headings-missing-middle-zero-or-more.json new file mode 100644 index 00000000..267593db --- /dev/null +++ b/test/required-headings-missing-middle-zero-or-more.json @@ -0,0 +1,14 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "*", + "### Three", + "*", + "### FOO", + "*", + "#### 7" + ] + } +} diff --git a/test/required-headings-missing-middle-zero-or-more.md b/test/required-headings-missing-middle-zero-or-more.md new file mode 100644 index 00000000..764d8b99 --- /dev/null +++ b/test/required-headings-missing-middle-zero-or-more.md @@ -0,0 +1,15 @@ +# One + +## Two + +### THREE + +## four + +## Five + +### SiX + +#### 7 + +{MD043:16} diff --git a/test/required-headings-zero-or-more-last.json b/test/required-headings-zero-or-more-last.json new file mode 100644 index 00000000..6f8e3bfb --- /dev/null +++ b/test/required-headings-zero-or-more-last.json @@ -0,0 +1,11 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "## Two", + "### Three", + "*" + ] + } +} diff --git a/test/required-headings-zero-or-more-last.md b/test/required-headings-zero-or-more-last.md new file mode 100644 index 00000000..f4cccf5d --- /dev/null +++ b/test/required-headings-zero-or-more-last.md @@ -0,0 +1,5 @@ +# One + +## Two + +### THREE diff --git a/test/reversed-link-issue-with-markdownlint-12.md b/test/reversed-link-issue-with-markdownlint-12.md index bd78a80c..2383d467 100644 --- a/test/reversed-link-issue-with-markdownlint-12.md +++ b/test/reversed-link-issue-with-markdownlint-12.md @@ -4,8 +4,6 @@ |-------------|-----------------| |`(?:\["'\](?<1>\[^"'\]*)["']|(?<1>\S+))`|...| -{MD011:5} - |Pattern|Description| |-------------|-----------------| |`(?:\["'\](?<1>\[^"'\]*)["']\|(?<1>\S+))`|...| diff --git a/test/reversed_link.md b/test/reversed_link.md index d27d69ea..e71c9725 100644 --- a/test/reversed_link.md +++ b/test/reversed_link.md @@ -1,17 +1,26 @@ # reversed_link +Go to [this website](https://www.example.com) + Go to (this website)[https://www.example.com] {MD011} +Go to (this)[website](https://www.example.com) + However, this shouldn't trigger inside code blocks: myObj.getFiles("test")[0] +Nor code fences: + +```js +myObj.getFiles(test)[0]; +``` + Nor inline code: `myobj.getFiles("test")[0]` Two (issues)[https://www.example.com/one] in {MD011} the (same text)[https://www.example.com/two]. {MD011} - Two (issues)[https://www.example.com/three] on the (same line)[https://www.example.com/four]. {MD011} `code code @@ -31,16 +40,40 @@ var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*'; {MD011} begin: /\B(([\/.])[\w\-.\/=]+)+/, {MD011} -{begin: '%r\\(', end: '\\)[a-z]*'} {MD011} +{begin: '%r\\(', end: '\\)[a-z]*'} return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); {MD011} ## Escaped Parens -(reversed)[link] {MD011} +(reversed)[link] -a ) a ( a )[a]~ {MD011} +a ) a ( a )[a]~ - +a
) a ( a )[a]~
-a
) a ( a )[a]~
{MD011} +## Backslash Escapes + +xxx(xxx)[xxx] {MD011} + +xxx\(xxx)[xxx] + +xxx(xxx\)[xxx] + +xxx(xxx)\[xxx] + +xxx(xxx)[xxx\] + +## Consecutive Links + +text [link](destination) text [link](destination) text +text [link](destination)[link](destination) text +text [link](destination)[link](destination)[link](destination) text + +text (reversed)[link] text (reversed)[link] text {MD011} + + diff --git a/test/spaces-inside-emphasis-markers-multiple-lines.md b/test/spaces-inside-emphasis-markers-multiple-lines.md index 4616ff55..18e43b1b 100644 --- a/test/spaces-inside-emphasis-markers-multiple-lines.md +++ b/test/spaces-inside-emphasis-markers-multiple-lines.md @@ -120,3 +120,10 @@ multi-line emphasis scenario * that should * not trigger violations * either`. + + +*text +```text +``` +text * + diff --git a/test/spaces_inside_emphasis_markers.md b/test/spaces_inside_emphasis_markers.md index 237c15ad..6735a2c3 100644 --- a/test/spaces_inside_emphasis_markers.md +++ b/test/spaces_inside_emphasis_markers.md @@ -341,3 +341,7 @@ text [reference*link] star * star text | x** y | x** y | | x _ y | x _ y | | x__ y | x__ y | + +```yaml /* autogenerated */ +# YAML... +```