Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdownlint-cli2

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdownlint-cli2 - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

export-markdownlint-helpers.js

558

markdownlint-cli2.js

@@ -16,4 +16,7 @@ #!/usr/bin/env node

const markdownlintLibrary = require("markdownlint");
const { markdownlint, "readConfig": markdownlintReadConfig } =
markdownlintLibrary.promises;
const {
markdownlint,
"extendConfig": markdownlintExtendConfig,
"readConfig": markdownlintReadConfig
} = markdownlintLibrary.promises;
const markdownlintRuleHelpers = require("markdownlint/helpers");

@@ -26,3 +29,3 @@ const appendToArray = require("./append-to-array");

const packageName = "markdownlint-cli2";
const packageVersion = "0.6.0";
const packageVersion = "0.7.0";
const libraryName = "markdownlint";

@@ -247,83 +250,100 @@ const libraryVersion = markdownlintLibrary.getVersion();

const getAndProcessDirInfo =
(fs, tasks, dirToDirInfo, dir, relativeDir, noRequire, func) => {
let dirInfo = dirToDirInfo[dir];
if (!dirInfo) {
dirInfo = {
dir,
relativeDir,
"parent": null,
"files": [],
"markdownlintConfig": null,
"markdownlintOptions": null
};
dirToDirInfo[dir] = dirInfo;
(fs, tasks, dirToDirInfo, dir, relativeDir, noRequire, func) => {
let dirInfo = dirToDirInfo[dir];
if (!dirInfo) {
dirInfo = {
dir,
relativeDir,
"parent": null,
"files": [],
"markdownlintConfig": null,
"markdownlintOptions": null
};
dirToDirInfo[dir] = dirInfo;
// Load markdownlint-cli2 object(s)
const markdownlintCli2Jsonc =
path.posix.join(dir, ".markdownlint-cli2.jsonc");
const markdownlintCli2Yaml =
path.posix.join(dir, ".markdownlint-cli2.yaml");
tasks.push(
fs.promises.access(markdownlintCli2Jsonc).
then(
() => fs.promises.
readFile(markdownlintCli2Jsonc, utf8).
then(
(content) => getJsoncParse().
then((jsoncParse) => jsoncParse(content))
),
() => fs.promises.access(markdownlintCli2Yaml).
then(
() => fs.promises.
readFile(markdownlintCli2Yaml, utf8).
then(yamlParse),
importOrRequireConfig(
fs,
dir,
".markdownlint-cli2.cjs",
noRequire,
// Load markdownlint-cli2 object(s)
const markdownlintCli2Jsonc =
path.posix.join(dir, ".markdownlint-cli2.jsonc");
const markdownlintCli2Yaml =
path.posix.join(dir, ".markdownlint-cli2.yaml");
tasks.push(
fs.promises.access(markdownlintCli2Jsonc).
then(
() => fs.promises.
readFile(markdownlintCli2Jsonc, utf8).
then(
(content) => getJsoncParse().
then((jsoncParse) => jsoncParse(content))
),
() => fs.promises.access(markdownlintCli2Yaml).
then(
() => fs.promises.
readFile(markdownlintCli2Yaml, utf8).
then(yamlParse),
importOrRequireConfig(
fs,
dir,
".markdownlint-cli2.mjs",
".markdownlint-cli2.cjs",
noRequire,
noop
importOrRequireConfig(
fs,
dir,
".markdownlint-cli2.mjs",
noRequire,
noop
)
)
)
)
).
then((options) => {
dirInfo.markdownlintOptions = options;
})
);
).
then((options) => {
dirInfo.markdownlintOptions = options;
return options &&
options.config &&
options.config.extends &&
getJsoncParse().
then(
(jsoncParse) => markdownlintExtendConfig(
options.config,
// Just needs to identify a file in the right directory
markdownlintCli2Jsonc,
[ jsoncParse, yamlParse ],
fs
)
).
then((config) => {
options.config = config;
});
})
);
// Load markdownlint object(s)
const readConfigs =
readConfig(
fs,
dir,
".markdownlint.jsonc",
// Load markdownlint object(s)
const readConfigs =
readConfig(
fs,
dir,
".markdownlint.json",
".markdownlint.jsonc",
readConfig(
fs,
dir,
".markdownlint.yaml",
".markdownlint.json",
readConfig(
fs,
dir,
".markdownlint.yml",
importOrRequireConfig(
".markdownlint.yaml",
readConfig(
fs,
dir,
".markdownlint.cjs",
noRequire,
".markdownlint.yml",
importOrRequireConfig(
fs,
dir,
".markdownlint.mjs",
".markdownlint.cjs",
noRequire,
noop
importOrRequireConfig(
fs,
dir,
".markdownlint.mjs",
noRequire,
noop
)
)

@@ -333,16 +353,15 @@ )

)
)
);
tasks.push(
readConfigs().
then((config) => {
dirInfo.markdownlintConfig = config;
})
);
tasks.push(
readConfigs().
then((config) => {
dirInfo.markdownlintConfig = config;
})
);
}
if (func) {
func(dirInfo);
}
return dirInfo;
};
}
if (func) {
func(dirInfo);
}
return dirInfo;
};

@@ -374,3 +393,6 @@ // Get base markdownlint-cli2 options object

mergeOptions(
mergeOptions(options, { "fix": fixDefault }),
mergeOptions(
{ "fix": fixDefault },
options
),
dirToDirInfo[baseDir].markdownlintOptions

@@ -399,77 +421,77 @@ );

const enumerateFiles =
// eslint-disable-next-line max-len
async (fs, baseDirSystem, baseDir, globPatterns, dirToDirInfo, noErrors, noRequire) => {
const tasks = [];
const globbyOptions = {
"absolute": true,
"cwd": baseDir,
"dot": true,
"expandDirectories": false,
fs
};
if (noErrors) {
globbyOptions.suppressErrors = true;
}
// Special-case literal files
const literalFiles = [];
const filteredGlobPatterns = globPatterns.filter(
(globPattern) => {
if (globPattern.startsWith(":")) {
literalFiles.push(
posixPath(path.resolve(baseDirSystem, globPattern.slice(1)))
);
return false;
}
return true;
// eslint-disable-next-line max-len
async (fs, baseDirSystem, baseDir, globPatterns, dirToDirInfo, noErrors, noRequire) => {
const tasks = [];
const globbyOptions = {
"absolute": true,
"cwd": baseDir,
"dot": true,
"expandDirectories": false,
fs
};
if (noErrors) {
globbyOptions.suppressErrors = true;
}
).map((globPattern) => globPattern.replace(/^\\:/u, ":"));
const baseMarkdownlintOptions = dirToDirInfo[baseDir].markdownlintOptions;
const globsForIgnore =
(baseMarkdownlintOptions.globs || []).
filter((glob) => glob.startsWith("!"));
const filteredLiteralFiles =
((literalFiles.length > 0) && (globsForIgnore.length > 0))
? removeIgnoredFiles(baseDir, literalFiles, globsForIgnore)
: literalFiles;
// Manually expand directories to avoid globby call to dir-glob.sync
const expandedDirectories = await Promise.all(
filteredGlobPatterns.map((globPattern) => {
const barePattern =
globPattern.startsWith("!")
? globPattern.slice(1)
: globPattern;
const globPath =
(path.posix.isAbsolute(barePattern) || path.isAbsolute(barePattern))
? barePattern
: path.posix.join(baseDir, barePattern);
return fs.promises.stat(globPath).
then((stats) => (stats.isDirectory()
? path.posix.join(globPattern, "**")
: globPattern)).
catch(() => globPattern);
})
);
// Process glob patterns
// eslint-disable-next-line no-inline-comments
const { globby } = await import(/* webpackMode: "eager" */ "globby");
const files = [
...await globby(expandedDirectories, globbyOptions),
...filteredLiteralFiles
];
for (const file of files) {
const dir = path.posix.dirname(file);
getAndProcessDirInfo(
fs,
tasks,
dirToDirInfo,
dir,
null,
noRequire,
(dirInfo) => {
dirInfo.files.push(file);
// Special-case literal files
const literalFiles = [];
const filteredGlobPatterns = globPatterns.filter(
(globPattern) => {
if (globPattern.startsWith(":")) {
literalFiles.push(
posixPath(path.resolve(baseDirSystem, globPattern.slice(1)))
);
return false;
}
return true;
}
).map((globPattern) => globPattern.replace(/^\\:/u, ":"));
const baseMarkdownlintOptions = dirToDirInfo[baseDir].markdownlintOptions;
const globsForIgnore =
(baseMarkdownlintOptions.globs || []).
filter((glob) => glob.startsWith("!"));
const filteredLiteralFiles =
((literalFiles.length > 0) && (globsForIgnore.length > 0))
? removeIgnoredFiles(baseDir, literalFiles, globsForIgnore)
: literalFiles;
// Manually expand directories to avoid globby call to dir-glob.sync
const expandedDirectories = await Promise.all(
filteredGlobPatterns.map((globPattern) => {
const barePattern =
globPattern.startsWith("!")
? globPattern.slice(1)
: globPattern;
const globPath =
(path.posix.isAbsolute(barePattern) || path.isAbsolute(barePattern))
? barePattern
: path.posix.join(baseDir, barePattern);
return fs.promises.stat(globPath).
then((stats) => (stats.isDirectory()
? path.posix.join(globPattern, "**")
: globPattern)).
catch(() => globPattern);
})
);
}
await Promise.all(tasks);
};
// Process glob patterns
// eslint-disable-next-line no-inline-comments
const { globby } = await import(/* webpackMode: "eager" */ "globby");
const files = [
...await globby(expandedDirectories, globbyOptions),
...filteredLiteralFiles
];
for (const file of files) {
const dir = path.posix.dirname(file);
getAndProcessDirInfo(
fs,
tasks,
dirToDirInfo,
dir,
null,
noRequire,
(dirInfo) => {
dirInfo.files.push(file);
}
);
}
await Promise.all(tasks);
};

@@ -523,131 +545,131 @@ // Enumerate (possibly missing) parent directories and update directory infos

const createDirInfos =
// eslint-disable-next-line max-len
async (fs, baseDirSystem, baseDir, globPatterns, dirToDirInfo, optionsOverride, noErrors, noRequire) => {
await enumerateFiles(
fs,
baseDirSystem,
baseDir,
globPatterns,
dirToDirInfo,
noErrors,
noRequire
);
await enumerateParents(
fs,
baseDir,
dirToDirInfo,
noRequire
);
// eslint-disable-next-line max-len
async (fs, baseDirSystem, baseDir, globPatterns, dirToDirInfo, optionsOverride, noErrors, noRequire) => {
await enumerateFiles(
fs,
baseDirSystem,
baseDir,
globPatterns,
dirToDirInfo,
noErrors,
noRequire
);
await enumerateParents(
fs,
baseDir,
dirToDirInfo,
noRequire
);
// Merge file lists with identical configuration
const dirs = Object.keys(dirToDirInfo);
dirs.sort((a, b) => b.length - a.length);
const dirInfos = [];
const noConfigDirInfo =
// eslint-disable-next-line unicorn/consistent-function-scoping
(dirInfo) => (
dirInfo.parent &&
!dirInfo.markdownlintConfig &&
!dirInfo.markdownlintOptions
);
const tasks = [];
for (const dir of dirs) {
const dirInfo = dirToDirInfo[dir];
if (noConfigDirInfo(dirInfo)) {
if (dirInfo.parent) {
appendToArray(dirInfo.parent.files, dirInfo.files);
// Merge file lists with identical configuration
const dirs = Object.keys(dirToDirInfo);
dirs.sort((a, b) => b.length - a.length);
const dirInfos = [];
const noConfigDirInfo =
// eslint-disable-next-line unicorn/consistent-function-scoping
(dirInfo) => (
dirInfo.parent &&
!dirInfo.markdownlintConfig &&
!dirInfo.markdownlintOptions
);
const tasks = [];
for (const dir of dirs) {
const dirInfo = dirToDirInfo[dir];
if (noConfigDirInfo(dirInfo)) {
if (dirInfo.parent) {
appendToArray(dirInfo.parent.files, dirInfo.files);
}
dirToDirInfo[dir] = null;
} else {
const { markdownlintOptions, relativeDir } = dirInfo;
if (markdownlintOptions && markdownlintOptions.customRules) {
tasks.push(
importOrRequireIds(
relativeDir || dir,
markdownlintOptions.customRules,
noRequire
).then((customRules) => {
// Expand nested arrays (for packages that export multiple rules)
markdownlintOptions.customRules = customRules.flat();
})
);
}
if (markdownlintOptions && markdownlintOptions.markdownItPlugins) {
tasks.push(
importOrRequireIdsAndParams(
relativeDir || dir,
markdownlintOptions.markdownItPlugins,
noRequire
).then((markdownItPlugins) => {
markdownlintOptions.markdownItPlugins = markdownItPlugins;
})
);
}
dirInfos.push(dirInfo);
}
dirToDirInfo[dir] = null;
} else {
const { markdownlintOptions, relativeDir } = dirInfo;
if (markdownlintOptions && markdownlintOptions.customRules) {
tasks.push(
importOrRequireIds(
relativeDir || dir,
markdownlintOptions.customRules,
noRequire
).then((customRules) => {
// Expand nested arrays (for packages that export multiple rules)
markdownlintOptions.customRules = customRules.flat();
})
);
}
await Promise.all(tasks);
for (const dirInfo of dirInfos) {
while (dirInfo.parent && !dirToDirInfo[dirInfo.parent.dir]) {
dirInfo.parent = dirInfo.parent.parent;
}
if (markdownlintOptions && markdownlintOptions.markdownItPlugins) {
tasks.push(
importOrRequireIdsAndParams(
relativeDir || dir,
markdownlintOptions.markdownItPlugins,
noRequire
).then((markdownItPlugins) => {
markdownlintOptions.markdownItPlugins = markdownItPlugins;
})
);
}
dirInfos.push(dirInfo);
}
}
await Promise.all(tasks);
for (const dirInfo of dirInfos) {
while (dirInfo.parent && !dirToDirInfo[dirInfo.parent.dir]) {
dirInfo.parent = dirInfo.parent.parent;
}
}
// Verify dirInfos is simplified
// if (
// dirInfos.filter(
// (di) => di.parent && !dirInfos.includes(di.parent)
// ).length > 0
// ) {
// throw new Error("Extra parent");
// }
// if (
// dirInfos.filter(
// (di) => !di.parent && (di.dir !== baseDir)
// ).length > 0
// ) {
// throw new Error("Missing parent");
// }
// if (
// dirInfos.filter(
// (di) => di.parent &&
// !((di.markdownlintConfig ? 1 : 0) ^ (di.markdownlintOptions ? 1 : 0))
// ).length > 0
// ) {
// throw new Error("Missing object");
// }
// if (dirInfos.filter((di) => di.dir === "/").length > 0) {
// throw new Error("Includes root");
// }
// Verify dirInfos is simplified
// if (
// dirInfos.filter(
// (di) => di.parent && !dirInfos.includes(di.parent)
// ).length > 0
// ) {
// throw new Error("Extra parent");
// }
// if (
// dirInfos.filter(
// (di) => !di.parent && (di.dir !== baseDir)
// ).length > 0
// ) {
// throw new Error("Missing parent");
// }
// if (
// dirInfos.filter(
// (di) => di.parent &&
// !((di.markdownlintConfig ? 1 : 0) ^ (di.markdownlintOptions ? 1 : 0))
// ).length > 0
// ) {
// throw new Error("Missing object");
// }
// if (dirInfos.filter((di) => di.dir === "/").length > 0) {
// throw new Error("Includes root");
// }
// Merge configuration by inheritance
for (const dirInfo of dirInfos) {
let markdownlintOptions = dirInfo.markdownlintOptions || {};
let { markdownlintConfig } = dirInfo;
let parent = dirInfo;
// eslint-disable-next-line prefer-destructuring
while ((parent = parent.parent)) {
if (parent.markdownlintOptions) {
markdownlintOptions = mergeOptions(
parent.markdownlintOptions,
markdownlintOptions
);
// Merge configuration by inheritance
for (const dirInfo of dirInfos) {
let markdownlintOptions = dirInfo.markdownlintOptions || {};
let { markdownlintConfig } = dirInfo;
let parent = dirInfo;
// eslint-disable-next-line prefer-destructuring
while ((parent = parent.parent)) {
if (parent.markdownlintOptions) {
markdownlintOptions = mergeOptions(
parent.markdownlintOptions,
markdownlintOptions
);
}
if (
!markdownlintConfig &&
parent.markdownlintConfig &&
!markdownlintOptions.config
) {
// eslint-disable-next-line prefer-destructuring
markdownlintConfig = parent.markdownlintConfig;
}
}
if (
!markdownlintConfig &&
parent.markdownlintConfig &&
!markdownlintOptions.config
) {
// eslint-disable-next-line prefer-destructuring
markdownlintConfig = parent.markdownlintConfig;
}
dirInfo.markdownlintOptions = mergeOptions(
markdownlintOptions,
optionsOverride
);
dirInfo.markdownlintConfig = markdownlintConfig;
}
dirInfo.markdownlintOptions = mergeOptions(
markdownlintOptions,
optionsOverride
);
dirInfo.markdownlintConfig = markdownlintConfig;
}
return dirInfos;
};
return dirInfos;
};

@@ -654,0 +676,0 @@ // Lint files in groups by shared configuration

{
"name": "markdownlint-cli2",
"version": "0.6.0",
"version": "0.7.0",
"description": "A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library",

@@ -12,3 +12,7 @@ "author": {

"main": "./markdownlint-cli2.js",
"exports": "./markdownlint-cli2.js",
"exports": {
".": "./markdownlint-cli2.js",
"./markdownlint": "./export-markdownlint.js",
"./markdownlint/helpers": "./export-markdownlint-helpers.js"
},
"bin": {

@@ -27,2 +31,3 @@ "markdownlint-cli2": "markdownlint-cli2.js",

"build-docker-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2:v$VERSION -f docker/Dockerfile --label org.opencontainers.image.version=v$VERSION .",
"build-docker-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2-rules:v$VERSION -f docker/Dockerfile-rules --build-arg VERSION=v$VERSION --label org.opencontainers.image.version=v$VERSION .",
"ci": "npm-run-all --continue-on-error --parallel test-cover lint",

@@ -37,6 +42,8 @@ "docker-npm-install": "docker run --rm --tty --name npm-install --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm install",

"test-docker-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:v$VERSION \"*.md\"",
"test-docker-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2-rules:v$VERSION \"*.md\"",
"test-docker-hub-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker image rm davidanson/markdownlint-cli2:v$VERSION davidanson/markdownlint-cli2:latest || true && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:v$VERSION \"*.md\" && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:latest \"*.md\"",
"test-docker-hub-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker image rm davidanson/markdownlint-cli2-rules:v$VERSION davidanson/markdownlint-cli2-rules:latest || true && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2-rules:v$VERSION \"*.md\" && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2-rules:latest \"*.md\"",
"test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test",
"test-watch": "git ls-files | entr npm run test",
"update-snapshots": "ava --update-snapshots test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js",
"update-snapshots": "ava --timeout=1m --update-snapshots test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js",
"upgrade": "npx --yes npm-check-updates --upgrade",

@@ -51,2 +58,4 @@ "webworker": "cd webworker && webpack --mode none",

"append-to-array.js",
"export-markdownlint.js",
"export-markdownlint-helpers.js",
"markdownlint-cli2.js",

@@ -59,5 +68,5 @@ "markdownlint-cli2-config.js",

"dependencies": {
"globby": "13.1.3",
"markdownlint": "0.27.0",
"markdownlint-cli2-formatter-default": "0.0.3",
"globby": "13.1.4",
"markdownlint": "0.28.1",
"markdownlint-cli2-formatter-default": "0.0.4",
"micromatch": "4.0.5",

@@ -69,17 +78,17 @@ "strip-json-comments": "5.0.0",

"@iktakahiro/markdown-it-katex": "4.0.1",
"ava": "5.1.0",
"c8": "7.12.0",
"ava": "5.2.0",
"c8": "7.13.0",
"cpy": "9.0.1",
"del": "7.0.0",
"eslint": "8.30.0",
"eslint-plugin-n": "15.6.0",
"eslint-plugin-unicorn": "45.0.2",
"execa": "6.1.0",
"eslint": "8.38.0",
"eslint-plugin-n": "15.7.0",
"eslint-plugin-unicorn": "46.0.0",
"execa": "7.1.1",
"markdown-it-emoji": "2.0.2",
"markdown-it-for-inline": "0.1.1",
"markdownlint-cli2-formatter-codequality": "0.0.1",
"markdownlint-cli2-formatter-json": "0.0.6",
"markdownlint-cli2-formatter-junit": "0.0.5",
"markdownlint-cli2-formatter-pretty": "0.0.3",
"markdownlint-cli2-formatter-summarize": "0.0.5",
"markdownlint-cli2-formatter-codequality": "0.0.4",
"markdownlint-cli2-formatter-json": "0.0.7",
"markdownlint-cli2-formatter-junit": "0.0.6",
"markdownlint-cli2-formatter-pretty": "0.0.4",
"markdownlint-cli2-formatter-summarize": "0.0.6",
"markdownlint-rule-titlecase": "0.1.0",

@@ -86,0 +95,0 @@ "npm-run-all": "4.1.5"

@@ -40,3 +40,3 @@ # markdownlint-cli2

- name: markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action@v9
```

@@ -149,3 +149,3 @@

```bash
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.6.0 "**/*.md" "#node_modules"
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.7.0 "**/*.md" "#node_modules"
```

@@ -167,3 +167,3 @@

```bash
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.6.0 "**/*.md" "#node_modules"
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.7.0 "**/*.md" "#node_modules"
```

@@ -175,5 +175,14 @@

```bash
docker run -v $PWD:/workdir --entrypoint="markdownlint-cli2-fix" davidanson/markdownlint-cli2:v0.6.0 "**/*.md" "#node_modules"
docker run -v $PWD:/workdir --entrypoint="markdownlint-cli2-fix" davidanson/markdownlint-cli2:v0.7.0 "**/*.md" "#node_modules"
```
For convenience, the container image
[`davidanson/markdownlint-cli2-rules`][docker-hub-markdownlint-cli2-rules]
includes the latest versions of custom rules published to npm with the tag
[`markdownlint-rule`][markdownlint-rule]. These rules are installed globally
onto the base image `davidanson/markdownlint-cli2`.
**Note**: This container image exists for convenience and is not an endorsement
of the rules within.
### Exit Codes

@@ -200,7 +209,16 @@

for enabling and disabling rules with HTML comments.
- In general, glob expressions match files under the current directory and the
configuration for that directory applies to the entire tree.
- In general, glob expressions should match files under the current directory;
the configuration for that directory will apply to the entire tree.
- When glob expressions match files *not* under the current directory,
configuration for the current directory is applied to the closest common
parent directory.
- There are two kinds of configuration file (both detailed below):
- Configuration files like `.markdownlint-cli2.*` allow complete control of
`markdownlint-cli2` behavior and are also used by `vscode-markdownlint`.
- Configuration files like `.markdownlint.*` allow control over only the
`markdownlint` `config` object and tend to be supported more broadly (such
as by `markdownlint-cli`).
- The VS Code extension `vscode-markdownlint` includes a schema definition for
the `JSON(C)` configuration files described below. This adds auto-complete and
can make it easier to define proper structure.

@@ -216,2 +234,4 @@ ### `.markdownlint-cli2.jsonc`

in the same directory, it overrides the value of this property
- If the `config` object contains an `extends` property, it will be resolved
the same as `.markdownlint.{jsonc,json,yaml,yml,js}` (see below)
- `customRules`: `Array` of `String`s (or `Array`s of `String`s) of module

@@ -367,3 +387,3 @@ names/paths of [custom rules][markdownlint-custom-rules] to load and use

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.6.0
rev: v0.7.0
hooks:

@@ -378,28 +398,3 @@ - id: markdownlint-cli2

- 0.0.2 - Initial release
- 0.0.3 - Feature parity with `markdownlint-cli`
- 0.0.4 - Support output formatters and `markdown-it` plugins
- 0.0.5 - Improve support for ignoring files
- 0.0.6 - Improve handling of very large directory trees
- 0.0.7 - Support `.markdownlint-cli2.js` and `.markdownlint.js`
- 0.0.8 - Support `.markdownlint-cli2.yaml`, add progress
- 0.0.9 - Improve configuration file handling
- 0.0.10 - Improve performance and configuration
- 0.0.11 - Improve performance of `fix`, update banner
- 0.0.12 - Update dependencies (including `markdownlint`)
- 0.0.13 - Add `markdownlint-cli2-fix` command
- 0.0.14 - Update dependencies (including `markdownlint`)
- 0.0.15 - Improve extensibility
- 0.1.0 - Simplify use of `require`, increment minor version
- 0.1.1 - Restore previous use of `require`
- 0.1.2 - Update use of `require` to be more flexible
- 0.1.3 - Support rule collections
- 0.2.0 - Improve handling of Windows paths using backslash
- 0.3.0 - Add Docker container, update dependencies
- 0.3.1 - Extensibility tweaks
- 0.3.2 - Extensibility/Windows/consistency improvements
- 0.4.0 - New rules, async custom rules, explicit config, CJS (breaking)
- 0.5.0 - New rules, support modules (MJS) everywhere, include dotfiles
- 0.5.1 - Update dependencies
- 0.6.0 - Update dependencies (including `markdownlint`)
See [CHANGELOG.md](CHANGELOG.md).

@@ -414,2 +409,3 @@ <!-- markdownlint-disable line-length -->

[docker-hub-markdownlint-cli2]: https://hub.docker.com/r/davidanson/markdownlint-cli2
[docker-hub-markdownlint-cli2-rules]: https://hub.docker.com/r/davidanson/markdownlint-cli2-rules
[front-matter]: https://jekyllrb.com/docs/frontmatter/

@@ -416,0 +412,0 @@ [github-action]: https://docs.github.com/actions

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc