markdownlint 0.23.1 → 0.24.0
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/README.md +35 -10
- package/demo/markdownlint-browser.js +253 -166
- package/doc/Prettier.md +23 -0
- package/doc/Rules.md +16 -1
- package/helpers/helpers.js +47 -5
- package/helpers/package.json +1 -1
- package/lib/cache.js +18 -9
- package/lib/markdownlint.d.ts +24 -8
- package/lib/markdownlint.js +106 -38
- package/lib/md010.js +5 -1
- package/lib/md011.js +31 -27
- package/lib/md037.js +14 -2
- package/lib/md043.js +8 -3
- package/lib/md044.js +54 -71
- package/package.json +24 -16
- package/schema/.markdownlint.jsonc +4 -2
- package/schema/.markdownlint.yaml +3 -1
- package/schema/markdownlint-config-schema.json +13 -3
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
|
|
@@ -295,7 +294,8 @@ function markdownlint(options) { ... }
|
|
|
295
294
|
|
|
296
295
|
Type: `Object`
|
|
297
296
|
|
|
298
|
-
Configures the function.
|
|
297
|
+
Configures the function. All properties are optional, but at least one
|
|
298
|
+
of `files` or `strings` should be set to provide input.
|
|
299
299
|
|
|
300
300
|
##### options.customRules
|
|
301
301
|
|
|
@@ -535,6 +535,16 @@ Each item in the top-level `Array` should be of the form:
|
|
|
535
535
|
[ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
|
|
536
536
|
```
|
|
537
537
|
|
|
538
|
+
##### options.fs
|
|
539
|
+
|
|
540
|
+
Type: `Object` implementing the [file system API](https://nodejs.org/api/fs.html)
|
|
541
|
+
|
|
542
|
+
In advanced scenarios, it may be desirable to bypass the default file system API.
|
|
543
|
+
If a custom file system implementation is provided, `markdownlint` will use that
|
|
544
|
+
instead of invoking `require("fs")`.
|
|
545
|
+
|
|
546
|
+
Note: The only methods called are `readFile` and `readFileSync`.
|
|
547
|
+
|
|
538
548
|
#### callback
|
|
539
549
|
|
|
540
550
|
Type: `Function` taking (`Error`, `Object`)
|
|
@@ -567,10 +577,11 @@ Asynchronous API:
|
|
|
567
577
|
*
|
|
568
578
|
* @param {string} file Configuration file name.
|
|
569
579
|
* @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s).
|
|
580
|
+
* @param {Object} [fs] File system implementation.
|
|
570
581
|
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
|
|
571
582
|
* @returns {void}
|
|
572
583
|
*/
|
|
573
|
-
function readConfig(file, parsers, callback) { ... }
|
|
584
|
+
function readConfig(file, parsers, fs, callback) { ... }
|
|
574
585
|
```
|
|
575
586
|
|
|
576
587
|
Synchronous API:
|
|
@@ -581,13 +592,14 @@ Synchronous API:
|
|
|
581
592
|
*
|
|
582
593
|
* @param {string} file Configuration file name.
|
|
583
594
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
595
|
+
* @param {Object} [fs] File system implementation.
|
|
584
596
|
* @returns {Configuration} Configuration object.
|
|
585
597
|
*/
|
|
586
|
-
function readConfigSync(file, parsers) { ... }
|
|
598
|
+
function readConfigSync(file, parsers, fs) { ... }
|
|
587
599
|
```
|
|
588
600
|
|
|
589
601
|
Promise API (in the `promises` namespace like Node.js's
|
|
590
|
-
[`fs` Promises API](https://nodejs.org/api/fs.html#
|
|
602
|
+
[`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)):
|
|
591
603
|
|
|
592
604
|
```js
|
|
593
605
|
/**
|
|
@@ -595,9 +607,10 @@ Promise API (in the `promises` namespace like Node.js's
|
|
|
595
607
|
*
|
|
596
608
|
* @param {string} file Configuration file name.
|
|
597
609
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
610
|
+
* @param {Object} [fs] File system implementation.
|
|
598
611
|
* @returns {Promise<Configuration>} Configuration object.
|
|
599
612
|
*/
|
|
600
|
-
function readConfig(file, parsers) { ... }
|
|
613
|
+
function readConfig(file, parsers, fs) { ... }
|
|
601
614
|
```
|
|
602
615
|
|
|
603
616
|
#### file
|
|
@@ -628,6 +641,16 @@ For example:
|
|
|
628
641
|
[ JSON.parse, require("toml").parse, require("js-yaml").load ]
|
|
629
642
|
```
|
|
630
643
|
|
|
644
|
+
#### fs
|
|
645
|
+
|
|
646
|
+
Type: *Optional* `Object` implementing the [file system API](https://nodejs.org/api/fs.html)
|
|
647
|
+
|
|
648
|
+
In advanced scenarios, it may be desirable to bypass the default file system API.
|
|
649
|
+
If a custom file system implementation is provided, `markdownlint` will use that
|
|
650
|
+
instead of invoking `require("fs")`.
|
|
651
|
+
|
|
652
|
+
Note: The only methods called are `readFile`, `readFileSync`, `access`, and `accessSync`.
|
|
653
|
+
|
|
631
654
|
#### callback
|
|
632
655
|
|
|
633
656
|
Type: `Function` taking (`Error`, `Object`)
|
|
@@ -835,7 +858,8 @@ const results = window.markdownlint.sync(options).toString();
|
|
|
835
858
|
|
|
836
859
|
## Examples
|
|
837
860
|
|
|
838
|
-
For ideas how to integrate `markdownlint` into your workflow, refer to the
|
|
861
|
+
For ideas how to integrate `markdownlint` into your workflow, refer to the
|
|
862
|
+
following projects or one of the tools in the [Related section](#Related):
|
|
839
863
|
|
|
840
864
|
* [.NET Documentation](https://docs.microsoft.com/en-us/dotnet/) ([Search repository](https://github.com/dotnet/docs/search?q=markdownlint))
|
|
841
865
|
* [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
|
|
|
843
867
|
* [CodiMD](https://github.com/hackmdio/codimd) ([Search repository](https://github.com/hackmdio/codimd/search?q=markdownlint))
|
|
844
868
|
* [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint))
|
|
845
869
|
* [Garden React Components](https://zendeskgarden.github.io/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint))
|
|
870
|
+
* [MDN Web Docs](https://developer.mozilla.org/) ([Search repository](https://github.com/mdn/content/search?q=markdownlint))
|
|
846
871
|
* [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint))
|
|
847
872
|
* [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint))
|
|
848
873
|
* [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint))
|
|
849
874
|
* [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint))
|
|
850
875
|
* [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
876
|
* [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint))
|
|
853
877
|
* [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint))
|
|
854
878
|
* [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.
|
|
|
941
965
|
information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve
|
|
942
966
|
HTML comment handling, update test runner and test suite, update dependencies.
|
|
943
967
|
* 0.23.1 - Work around lack of webpack support for dynamic calls to `require` (`.resolve`).
|
|
968
|
+
* 0.24.0 - Remove support for end-of-life Node version 10, add support for custom file system
|
|
969
|
+
module, improve MD010/MD011/MD037/MD043/MD044, improve TypeScript declaration file
|
|
970
|
+
and JSON schema, update dependencies.
|
|
944
971
|
|
|
945
972
|
[npm-image]: https://img.shields.io/npm/v/markdownlint.svg
|
|
946
973
|
[npm-url]: https://www.npmjs.com/package/markdownlint
|
|
947
|
-
[ci-image]: https://github.com/DavidAnson/markdownlint/workflows/CI/badge.svg?branch=main
|
|
948
|
-
[ci-url]: https://github.com/DavidAnson/markdownlint/actions?query=branch%3Amain
|
|
949
974
|
[license-image]: https://img.shields.io/npm/l/markdownlint.svg
|
|
950
975
|
[license-url]: https://opensource.org/licenses/MIT
|