markdownlint 0.23.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +13 -3
- package/LICENSE +1 -1
- package/README.md +53 -16
- package/demo/markdownlint-browser.js +769 -461
- package/doc/CustomRules.md +15 -4
- package/doc/Prettier.md +23 -0
- package/doc/Rules.md +100 -12
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +199 -39
- package/helpers/package.json +1 -1
- package/lib/cache.js +14 -5
- package/lib/constants.js +7 -0
- package/lib/markdownlint.d.ts +30 -10
- package/lib/markdownlint.js +326 -247
- package/lib/md007.js +4 -2
- package/lib/md010.js +25 -16
- package/lib/md011.js +31 -27
- package/lib/md033.js +12 -8
- package/lib/md035.js +4 -4
- package/lib/md037.js +19 -5
- package/lib/md039.js +2 -1
- package/lib/md043.js +8 -4
- package/lib/md044.js +54 -71
- package/lib/md049.js +45 -0
- package/lib/md050.js +45 -0
- package/lib/rules.js +4 -4
- package/package.json +44 -34
- package/schema/.markdownlint.jsonc +19 -3
- package/schema/.markdownlint.yaml +15 -1
- package/schema/markdownlint-config-schema.json +108 -4
- package/schema/build-config-example.js +0 -53
- package/schema/build-config-schema.js +0 -420
package/CONTRIBUTING.md
CHANGED
|
@@ -23,7 +23,7 @@ Try to break the new code now, or else it will get broken later.
|
|
|
23
23
|
|
|
24
24
|
Run tests before sending a pull request via `npm test` in the [usual manner](https://docs.npmjs.com/misc/scripts).
|
|
25
25
|
Tests should all pass on all platforms.
|
|
26
|
-
The test runner is [
|
|
26
|
+
The test runner is [AVA](https://github.com/avajs/ava) and test cases are located in `test/markdownlint-test*.js`.
|
|
27
27
|
When running tests, `test/*.md` files are enumerated, linted, and fail if any violations are missing a corresponding `{MD###}` marker in the test file.
|
|
28
28
|
For example, the line `### Heading {MD001}` is expected to trigger the rule `MD001`.
|
|
29
29
|
For cases where the marker text can not be present on the same line, the syntax `{MD###:#}` can be used to include a line number.
|
|
@@ -33,7 +33,8 @@ Lint before sending a pull request by running `npm run lint`.
|
|
|
33
33
|
There should be no issues.
|
|
34
34
|
|
|
35
35
|
Run a full continuous integration pass before sending a pull request via `npm run ci`.
|
|
36
|
-
Code coverage should
|
|
36
|
+
Code coverage should always be 100%.
|
|
37
|
+
As part of a continuous integration run, generated files may get updated and fail the run - commit them to the repository and rerun continuous integration.
|
|
37
38
|
|
|
38
39
|
Pull requests should contain a single commit.
|
|
39
40
|
If necessary, squash multiple commits before creating the pull request and when making changes.
|
|
@@ -43,9 +44,18 @@ Open pull requests against the `next` branch.
|
|
|
43
44
|
That's where the latest changes are staged for the next release.
|
|
44
45
|
Include the text "(fixes #??)" at the end of the commit message so the pull request will be associated with the relevant issue.
|
|
45
46
|
End commit messages with a period (`.`).
|
|
46
|
-
Do not include `package-lock.json` in the pull request.
|
|
47
47
|
Once accepted, the tag `fixed in next` will be added to the issue.
|
|
48
48
|
When the commit is merged to the main branch during the release process, the issue will be closed automatically.
|
|
49
49
|
(See [Closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/) for details.)
|
|
50
50
|
|
|
51
|
+
Please refrain from using slang or meaningless placeholder words.
|
|
52
|
+
Sample content can be "text", "code", "heading", or the like.
|
|
53
|
+
Sample URLs should use [example.com](https://en.wikipedia.org/wiki/Example.com) which is safe for this purpose.
|
|
54
|
+
Profanity is not allowed.
|
|
55
|
+
|
|
56
|
+
In order to maintain the permissive MIT license this project uses, all contributions must be your own and released under that license.
|
|
57
|
+
Code you add should be an original work and should not be copied from elsewhere.
|
|
58
|
+
Taking code from a different project, Stack Overflow, or the like is not allowed.
|
|
59
|
+
The use of tools such as GitHub Copilot that generate code from other projects is not allowed.
|
|
60
|
+
|
|
51
61
|
Thank you!
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
> A Node.js style checker and lint tool for Markdown/CommonMark files.
|
|
4
4
|
|
|
5
5
|
[![npm version][npm-image]][npm-url]
|
|
6
|
-
[![CI Status][ci-image]][ci-url]
|
|
7
6
|
[![License][license-image]][license-url]
|
|
8
7
|
|
|
9
8
|
## Install
|
|
@@ -34,8 +33,10 @@ and test cases came directly from that project.
|
|
|
34
33
|
### Related
|
|
35
34
|
|
|
36
35
|
* CLI
|
|
37
|
-
* [markdownlint-cli
|
|
38
|
-
|
|
36
|
+
* [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli)
|
|
37
|
+
command-line interface for Node.js ([works with pre-commit](https://github.com/igorshubovych/markdownlint-cli#use-with-pre-commit))
|
|
38
|
+
* [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2)
|
|
39
|
+
command-line interface for Node.js ([works with pre-commit](https://github.com/DavidAnson/markdownlint-cli2#pre-commit))
|
|
39
40
|
* GitHub
|
|
40
41
|
* [GitHub Super-Linter Action](https://github.com/github/super-linter)
|
|
41
42
|
* [GitHub Actions problem matcher for markdownlint-cli](https://github.com/xt0rted/markdownlint-problem-matcher)
|
|
@@ -103,6 +104,8 @@ playground for learning and exploring.
|
|
|
103
104
|
* **[MD046](doc/Rules.md#md046)** *code-block-style* - Code block style
|
|
104
105
|
* **[MD047](doc/Rules.md#md047)** *single-trailing-newline* - Files should end with a single newline character
|
|
105
106
|
* **[MD048](doc/Rules.md#md048)** *code-fence-style* - Code fence style
|
|
107
|
+
* **[MD049](doc/Rules.md#md049)** *emphasis-style* - Emphasis style should be consistent
|
|
108
|
+
* **[MD050](doc/Rules.md#md050)** *strong-style* - Strong style should be consistent
|
|
106
109
|
|
|
107
110
|
<!-- markdownlint-restore -->
|
|
108
111
|
|
|
@@ -126,7 +129,7 @@ rules at once.
|
|
|
126
129
|
* **blockquote** - MD027, MD028
|
|
127
130
|
* **bullet** - MD004, MD005, MD006, MD007, MD032
|
|
128
131
|
* **code** - MD014, MD031, MD038, MD040, MD046, MD048
|
|
129
|
-
* **emphasis** - MD036, MD037
|
|
132
|
+
* **emphasis** - MD036, MD037, MD049, MD050
|
|
130
133
|
* **hard_tab** - MD010
|
|
131
134
|
* **headers** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022,
|
|
132
135
|
MD023, MD024, MD025, MD026, MD036, MD041, MD043
|
|
@@ -164,10 +167,12 @@ appear in the final markup):
|
|
|
164
167
|
|
|
165
168
|
* Disable all rules: `<!-- markdownlint-disable -->`
|
|
166
169
|
* Enable all rules: `<!-- markdownlint-enable -->`
|
|
167
|
-
* Disable all rules for the next line only:
|
|
170
|
+
* Disable all rules for the next line only:
|
|
171
|
+
`<!-- markdownlint-disable-next-line -->`
|
|
168
172
|
* Disable one or more rules by name: `<!-- markdownlint-disable MD001 MD005 -->`
|
|
169
173
|
* Enable one or more rules by name: `<!-- markdownlint-enable MD001 MD005 -->`
|
|
170
|
-
* Disable one or more rules by name for the next line only:
|
|
174
|
+
* Disable one or more rules by name for the next line only:
|
|
175
|
+
`<!-- markdownlint-disable-next-line MD001 MD005 -->`
|
|
171
176
|
* Capture the current rule configuration: `<!-- markdownlint-capture -->`
|
|
172
177
|
* Restore the captured rule configuration: `<!-- markdownlint-restore -->`
|
|
173
178
|
|
|
@@ -230,7 +235,7 @@ more rules for a file, the following more advanced syntax is supported:
|
|
|
230
235
|
For example:
|
|
231
236
|
|
|
232
237
|
```markdown
|
|
233
|
-
<!-- markdownlint-configure-file { "MD013": { "
|
|
238
|
+
<!-- markdownlint-configure-file { "MD013": { "code_blocks": false } } -->
|
|
234
239
|
```
|
|
235
240
|
|
|
236
241
|
or
|
|
@@ -295,7 +300,8 @@ function markdownlint(options) { ... }
|
|
|
295
300
|
|
|
296
301
|
Type: `Object`
|
|
297
302
|
|
|
298
|
-
Configures the function.
|
|
303
|
+
Configures the function. All properties are optional, but at least one
|
|
304
|
+
of `files` or `strings` should be set to provide input.
|
|
299
305
|
|
|
300
306
|
##### options.customRules
|
|
301
307
|
|
|
@@ -535,6 +541,16 @@ Each item in the top-level `Array` should be of the form:
|
|
|
535
541
|
[ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
|
|
536
542
|
```
|
|
537
543
|
|
|
544
|
+
##### options.fs
|
|
545
|
+
|
|
546
|
+
Type: `Object` implementing the [file system API](https://nodejs.org/api/fs.html)
|
|
547
|
+
|
|
548
|
+
In advanced scenarios, it may be desirable to bypass the default file system API.
|
|
549
|
+
If a custom file system implementation is provided, `markdownlint` will use that
|
|
550
|
+
instead of invoking `require("fs")`.
|
|
551
|
+
|
|
552
|
+
Note: The only methods called are `readFile` and `readFileSync`.
|
|
553
|
+
|
|
538
554
|
#### callback
|
|
539
555
|
|
|
540
556
|
Type: `Function` taking (`Error`, `Object`)
|
|
@@ -567,10 +583,11 @@ Asynchronous API:
|
|
|
567
583
|
*
|
|
568
584
|
* @param {string} file Configuration file name.
|
|
569
585
|
* @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s).
|
|
586
|
+
* @param {Object} [fs] File system implementation.
|
|
570
587
|
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
|
|
571
588
|
* @returns {void}
|
|
572
589
|
*/
|
|
573
|
-
function readConfig(file, parsers, callback) { ... }
|
|
590
|
+
function readConfig(file, parsers, fs, callback) { ... }
|
|
574
591
|
```
|
|
575
592
|
|
|
576
593
|
Synchronous API:
|
|
@@ -581,13 +598,14 @@ Synchronous API:
|
|
|
581
598
|
*
|
|
582
599
|
* @param {string} file Configuration file name.
|
|
583
600
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
601
|
+
* @param {Object} [fs] File system implementation.
|
|
584
602
|
* @returns {Configuration} Configuration object.
|
|
585
603
|
*/
|
|
586
|
-
function readConfigSync(file, parsers) { ... }
|
|
604
|
+
function readConfigSync(file, parsers, fs) { ... }
|
|
587
605
|
```
|
|
588
606
|
|
|
589
607
|
Promise API (in the `promises` namespace like Node.js's
|
|
590
|
-
[`fs` Promises API](https://nodejs.org/api/fs.html#
|
|
608
|
+
[`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)):
|
|
591
609
|
|
|
592
610
|
```js
|
|
593
611
|
/**
|
|
@@ -595,9 +613,10 @@ Promise API (in the `promises` namespace like Node.js's
|
|
|
595
613
|
*
|
|
596
614
|
* @param {string} file Configuration file name.
|
|
597
615
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
616
|
+
* @param {Object} [fs] File system implementation.
|
|
598
617
|
* @returns {Promise<Configuration>} Configuration object.
|
|
599
618
|
*/
|
|
600
|
-
function readConfig(file, parsers) { ... }
|
|
619
|
+
function readConfig(file, parsers, fs) { ... }
|
|
601
620
|
```
|
|
602
621
|
|
|
603
622
|
#### file
|
|
@@ -628,6 +647,16 @@ For example:
|
|
|
628
647
|
[ JSON.parse, require("toml").parse, require("js-yaml").load ]
|
|
629
648
|
```
|
|
630
649
|
|
|
650
|
+
#### fs
|
|
651
|
+
|
|
652
|
+
Type: *Optional* `Object` implementing the [file system API](https://nodejs.org/api/fs.html)
|
|
653
|
+
|
|
654
|
+
In advanced scenarios, it may be desirable to bypass the default file system API.
|
|
655
|
+
If a custom file system implementation is provided, `markdownlint` will use that
|
|
656
|
+
instead of invoking `require("fs")`.
|
|
657
|
+
|
|
658
|
+
Note: The only methods called are `readFile`, `readFileSync`, `access`, and `accessSync`.
|
|
659
|
+
|
|
631
660
|
#### callback
|
|
632
661
|
|
|
633
662
|
Type: `Function` taking (`Error`, `Object`)
|
|
@@ -835,7 +864,8 @@ const results = window.markdownlint.sync(options).toString();
|
|
|
835
864
|
|
|
836
865
|
## Examples
|
|
837
866
|
|
|
838
|
-
For ideas how to integrate `markdownlint` into your workflow, refer to the
|
|
867
|
+
For ideas how to integrate `markdownlint` into your workflow, refer to the
|
|
868
|
+
following projects or one of the tools in the [Related section](#related):
|
|
839
869
|
|
|
840
870
|
* [.NET Documentation](https://docs.microsoft.com/en-us/dotnet/) ([Search repository](https://github.com/dotnet/docs/search?q=markdownlint))
|
|
841
871
|
* [ally.js](https://allyjs.io/) ([Search repository](https://github.com/medialize/ally.js/search?q=markdownlint))
|
|
@@ -843,12 +873,13 @@ For ideas how to integrate `markdownlint` into your workflow, refer to the follo
|
|
|
843
873
|
* [CodiMD](https://github.com/hackmdio/codimd) ([Search repository](https://github.com/hackmdio/codimd/search?q=markdownlint))
|
|
844
874
|
* [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint))
|
|
845
875
|
* [Garden React Components](https://zendeskgarden.github.io/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint))
|
|
876
|
+
* [MDN Web Docs](https://developer.mozilla.org/) ([Search repository](https://github.com/mdn/content/search?q=markdownlint))
|
|
846
877
|
* [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint))
|
|
847
878
|
* [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint))
|
|
879
|
+
* [Pi-hole documentation](https://docs.pi-hole.net) ([Search repository](https://github.com/pi-hole/docs/search?q=markdownlint))
|
|
848
880
|
* [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint))
|
|
849
881
|
* [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint))
|
|
850
882
|
* [TestCafe](https://devexpress.github.io/testcafe/) ([Search repository](https://github.com/DevExpress/testcafe/search?q=markdownlint))
|
|
851
|
-
* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) ([Search repository](https://github.com/Microsoft/TypeScript-Handbook/search?q=markdownlint))
|
|
852
883
|
* [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint))
|
|
853
884
|
* [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint))
|
|
854
885
|
* [webpack](https://webpack.js.org/) ([Search repository](https://github.com/webpack/webpack.js.org/search?q=markdownlint))
|
|
@@ -940,10 +971,16 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
|
|
940
971
|
* 0.23.0 - Add comprehensive example `.markdownlint.jsonc`/`.markdownlint.yaml` files, add fix
|
|
941
972
|
information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve
|
|
942
973
|
HTML comment handling, update test runner and test suite, update dependencies.
|
|
974
|
+
* 0.23.1 - Work around lack of webpack support for dynamic calls to `require` (`.resolve`).
|
|
975
|
+
* 0.24.0 - Remove support for end-of-life Node version 10, add support for custom file system
|
|
976
|
+
module, improve MD010/MD011/MD037/MD043/MD044, improve TypeScript declaration file
|
|
977
|
+
and JSON schema, update dependencies.
|
|
978
|
+
* 0.25.0 - Add MD049/MD050 for consistent emphasis/strong style (both auto-fixable), improve
|
|
979
|
+
MD007/MD010/MD032/MD033/MD035/MD037/MD039, support asynchronous custom rules,
|
|
980
|
+
improve performance, improve CI process, reduce dependencies, update dependencies.
|
|
981
|
+
* 0.25.1 - Update dependencies for CVE-2022-21670.
|
|
943
982
|
|
|
944
983
|
[npm-image]: https://img.shields.io/npm/v/markdownlint.svg
|
|
945
984
|
[npm-url]: https://www.npmjs.com/package/markdownlint
|
|
946
|
-
[ci-image]: https://github.com/DavidAnson/markdownlint/workflows/CI/badge.svg?branch=main
|
|
947
|
-
[ci-url]: https://github.com/DavidAnson/markdownlint/actions?query=branch%3Amain
|
|
948
985
|
[license-image]: https://img.shields.io/npm/l/markdownlint.svg
|
|
949
986
|
[license-url]: https://opensource.org/licenses/MIT
|