markdownlint 0.22.0 → 0.25.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/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 [tape](https://www.npmjs.com/package/tape) and test cases are located in `test/markdownlint-test*.js`.
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 remain at 100%.
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2020 David Anson
3
+ Copyright (c) 2015-2021 David Anson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
@@ -14,12 +13,13 @@ npm install markdownlint --save-dev
14
13
 
15
14
  ## Overview
16
15
 
17
- The [Markdown](https://en.wikipedia.org/wiki/Markdown) markup language is
18
- designed to be easy to read, write, and understand. It succeeds - and its
19
- flexibility is both a benefit and a drawback. Many styles are possible, so
20
- formatting can be inconsistent. Some constructs don't work well in all
21
- parsers and should be avoided. The [CommonMark](https://commonmark.org/)
22
- specification standardizes parsers - but not authors.
16
+ The [Markdown](https://en.wikipedia.org/wiki/Markdown) markup language
17
+ is designed to be easy to read, write, and understand. It succeeds -
18
+ and its flexibility is both a benefit and a drawback. Many styles are
19
+ possible, so formatting can be inconsistent. Some constructs don't
20
+ work well in all parsers and should be avoided. The
21
+ [CommonMark](https://commonmark.org/) specification standardizes
22
+ parsers - but not authors.
23
23
 
24
24
  `markdownlint` is a
25
25
  [static analysis](https://en.wikipedia.org/wiki/Static_program_analysis)
@@ -33,13 +33,15 @@ and test cases came directly from that project.
33
33
  ### Related
34
34
 
35
35
  * CLI
36
- * [markdownlint-cli command-line interface for Node.js](https://github.com/igorshubovych/markdownlint-cli)
37
- * [markdownlint-cli2 command-line interface for Node.js](https://github.com/DavidAnson/markdownlint-cli2)
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))
38
40
  * GitHub
39
41
  * [GitHub Super-Linter Action](https://github.com/github/super-linter)
40
42
  * [GitHub Actions problem matcher for markdownlint-cli](https://github.com/xt0rted/markdownlint-problem-matcher)
41
43
  * Editor
42
- * [vscode-markdownlint extension for VS Code](https://marketplace.visualstudio.com/items/DavidAnson.vscode-markdownlint)
44
+ * [vscode-markdownlint extension for VS Code](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
43
45
  * [Sublime Text markdownlint for Sublime Text](https://packagecontrol.io/packages/SublimeLinter-contrib-markdownlint)
44
46
  * [linter-node-markdownlint extension for Atom](https://atom.io/packages/linter-node-markdownlint)
45
47
  * [coc-markdownlint extension for Vim/Neovim](https://github.com/fannheyward/coc-markdownlint)
@@ -56,8 +58,10 @@ playground for learning and exploring.
56
58
 
57
59
  ## Rules / Aliases
58
60
 
61
+ <!-- markdownlint-disable line-length -->
62
+
59
63
  * **[MD001](doc/Rules.md#md001)** *heading-increment/header-increment* - Heading levels should only increment by one level at a time
60
- * ~~**[MD002](doc/Rules.md#md002)** *first-heading-h1/first-header-h1* - First heading should be a top level heading~~
64
+ * ~~**[MD002](doc/Rules.md#md002)** *first-heading-h1/first-header-h1* - First heading should be a top-level heading~~
61
65
  * **[MD003](doc/Rules.md#md003)** *heading-style/header-style* - Heading style
62
66
  * **[MD004](doc/Rules.md#md004)** *ul-style* - Unordered list style
63
67
  * **[MD005](doc/Rules.md#md005)** *list-indent* - Inconsistent indentation for list items at the same level
@@ -76,7 +80,7 @@ playground for learning and exploring.
76
80
  * **[MD022](doc/Rules.md#md022)** *blanks-around-headings/blanks-around-headers* - Headings should be surrounded by blank lines
77
81
  * **[MD023](doc/Rules.md#md023)** *heading-start-left/header-start-left* - Headings must start at the beginning of the line
78
82
  * **[MD024](doc/Rules.md#md024)** *no-duplicate-heading/no-duplicate-header* - Multiple headings with the same content
79
- * **[MD025](doc/Rules.md#md025)** *single-title/single-h1* - Multiple top level headings in the same document
83
+ * **[MD025](doc/Rules.md#md025)** *single-title/single-h1* - Multiple top-level headings in the same document
80
84
  * **[MD026](doc/Rules.md#md026)** *no-trailing-punctuation* - Trailing punctuation in heading
81
85
  * **[MD027](doc/Rules.md#md027)** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol
82
86
  * **[MD028](doc/Rules.md#md028)** *no-blanks-blockquote* - Blank line inside blockquote
@@ -92,7 +96,7 @@ playground for learning and exploring.
92
96
  * **[MD038](doc/Rules.md#md038)** *no-space-in-code* - Spaces inside code span elements
93
97
  * **[MD039](doc/Rules.md#md039)** *no-space-in-links* - Spaces inside link text
94
98
  * **[MD040](doc/Rules.md#md040)** *fenced-code-language* - Fenced code blocks should have a language specified
95
- * **[MD041](doc/Rules.md#md041)** *first-line-heading/first-line-h1* - First line in file should be a top level heading
99
+ * **[MD041](doc/Rules.md#md041)** *first-line-heading/first-line-h1* - First line in a file should be a top-level heading
96
100
  * **[MD042](doc/Rules.md#md042)** *no-empty-links* - No empty links
97
101
  * **[MD043](doc/Rules.md#md043)** *required-headings/required-headers* - Required heading structure
98
102
  * **[MD044](doc/Rules.md#md044)** *proper-names* - Proper names should have the correct capitalization
@@ -100,18 +104,23 @@ playground for learning and exploring.
100
104
  * **[MD046](doc/Rules.md#md046)** *code-block-style* - Code block style
101
105
  * **[MD047](doc/Rules.md#md047)** *single-trailing-newline* - Files should end with a single newline character
102
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
109
+
110
+ <!-- markdownlint-restore -->
103
111
 
104
112
  See [Rules.md](doc/Rules.md) for more details.
105
113
 
106
114
  ~~Struck through~~ rules are deprecated, and provided for backward-compatibility.
107
115
 
108
- > All rules with `heading` as part of their name are also available as `header`
109
- > aliases (e.g. `heading-increment` is also available as `header-increment`).
116
+ > All rules with `heading` as part of their name are also available as
117
+ > `header` aliases (e.g. `heading-increment` is also available as `header-increment`).
110
118
  > The use of `header` is deprecated and provided for backward-compatibility.
111
119
 
112
120
  ## Tags
113
121
 
114
- Tags group related rules and can be used to enable/disable multiple rules at once.
122
+ Tags group related rules and can be used to enable/disable multiple
123
+ rules at once.
115
124
 
116
125
  * **accessibility** - MD045
117
126
  * **atx** - MD018, MD019
@@ -120,12 +129,12 @@ Tags group related rules and can be used to enable/disable multiple rules at onc
120
129
  * **blockquote** - MD027, MD028
121
130
  * **bullet** - MD004, MD005, MD006, MD007, MD032
122
131
  * **code** - MD014, MD031, MD038, MD040, MD046, MD048
123
- * **emphasis** - MD036, MD037
132
+ * **emphasis** - MD036, MD037, MD049, MD050
124
133
  * **hard_tab** - MD010
125
- * **headers** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023,
126
- MD024, MD025, MD026, MD036, MD041, MD043
127
- * **headings** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023,
128
- MD024, MD025, MD026, MD036, MD041, MD043
134
+ * **headers** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022,
135
+ MD023, MD024, MD025, MD026, MD036, MD041, MD043
136
+ * **headings** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022,
137
+ MD023, MD024, MD025, MD026, MD036, MD041, MD043
129
138
  * **hr** - MD035
130
139
  * **html** - MD033
131
140
  * **images** - MD045
@@ -138,27 +147,32 @@ Tags group related rules and can be used to enable/disable multiple rules at onc
138
147
  * **spelling** - MD044
139
148
  * **ul** - MD004, MD005, MD006, MD007, MD030, MD032
140
149
  * **url** - MD034
141
- * **whitespace** - MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039
150
+ * **whitespace** - MD009, MD010, MD012, MD027, MD028, MD030, MD037,
151
+ MD038, MD039
142
152
 
143
153
  ## Configuration
144
154
 
145
- Text passed to `markdownlint` is parsed as Markdown, analyzed, and any issues reported.
146
- Two kinds of text are ignored:
155
+ Text passed to `markdownlint` is parsed as Markdown, analyzed, and any
156
+ issues reported. Two kinds of text are ignored:
147
157
 
148
158
  * [HTML comments](https://www.w3.org/TR/html5/syntax.html#comments)
149
- * [Front matter](https://jekyllrb.com/docs/frontmatter/) (see `options.frontMatter` below)
159
+ * [Front matter](https://jekyllrb.com/docs/frontmatter/) (see
160
+ `options.frontMatter` below)
150
161
 
151
- Rules can be enabled, disabled, and configured via `options.config` (described
152
- below) to define the expected behavior for a set of inputs. To enable or disable
153
- rules at a particular location within a file, add one of these markers to the
154
- appropriate place (HTML comments don't appear in the final markup):
162
+ Rules can be enabled, disabled, and configured via `options.config`
163
+ (described below) to define the expected behavior for a set of inputs.
164
+ To enable or disable rules at a particular location within a file, add
165
+ one of these markers to the appropriate place (HTML comments don't
166
+ appear in the final markup):
155
167
 
156
168
  * Disable all rules: `<!-- markdownlint-disable -->`
157
169
  * Enable all rules: `<!-- markdownlint-enable -->`
158
- * Disable all rules for the next line only: `<!-- markdownlint-disable-next-line -->`
170
+ * Disable all rules for the next line only:
171
+ `<!-- markdownlint-disable-next-line -->`
159
172
  * Disable one or more rules by name: `<!-- markdownlint-disable MD001 MD005 -->`
160
173
  * Enable one or more rules by name: `<!-- markdownlint-enable MD001 MD005 -->`
161
- * Disable one or more rules by name for the next line only: `<!-- markdownlint-disable-next-line MD001 MD005 -->`
174
+ * Disable one or more rules by name for the next line only:
175
+ `<!-- markdownlint-disable-next-line MD001 MD005 -->`
162
176
  * Capture the current rule configuration: `<!-- markdownlint-capture -->`
163
177
  * Restore the captured rule configuration: `<!-- markdownlint-restore -->`
164
178
 
@@ -186,9 +200,9 @@ any violations you want
186
200
  <!-- markdownlint-restore -->
187
201
  ```
188
202
 
189
- The initial configuration is captured by default (as if every document began
190
- with `<!-- markdownlint-capture -->`), so the pattern above can be expressed
191
- more simply:
203
+ The initial configuration is captured by default (as if every document
204
+ began with `<!-- markdownlint-capture -->`), so the pattern above can
205
+ be expressed more simply:
192
206
 
193
207
  ```markdown
194
208
  <!-- markdownlint-disable -->
@@ -213,15 +227,15 @@ the following syntax is supported:
213
227
 
214
228
  This can be used to "hide" `markdownlint` comments at the bottom of a file.
215
229
 
216
- In cases where it is desirable to change the configuration of one or more rules
217
- for a file, the following more advanced syntax is supported:
230
+ In cases where it is desirable to change the configuration of one or
231
+ more rules for a file, the following more advanced syntax is supported:
218
232
 
219
233
  * Configure: `<!-- markdownlint-configure-file { options.config JSON } -->`
220
234
 
221
235
  For example:
222
236
 
223
237
  ```markdown
224
- <!-- markdownlint-configure-file { "MD013": { "line_length": 70 } } -->
238
+ <!-- markdownlint-configure-file { "MD013": { "code_blocks": false } } -->
225
239
  ```
226
240
 
227
241
  or
@@ -237,8 +251,8 @@ or
237
251
  -->
238
252
  ```
239
253
 
240
- These changes apply to the entire file regardless of where the comment is
241
- located. Multiple such comments (if present) are applied top-to-bottom.
254
+ These changes apply to the entire file regardless of where the comment
255
+ is located. Multiple such comments (if present) are applied top-to-bottom.
242
256
 
243
257
  ## API
244
258
 
@@ -286,7 +300,8 @@ function markdownlint(options) { ... }
286
300
 
287
301
  Type: `Object`
288
302
 
289
- 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.
290
305
 
291
306
  ##### options.customRules
292
307
 
@@ -294,8 +309,9 @@ Type: `Array` of `Object`
294
309
 
295
310
  List of custom rules to include with the default rule set for linting.
296
311
 
297
- Each array element should define a rule. Rules are typically exported by another
298
- package, but can be defined locally. Custom rules are identified by the
312
+ Each array element should define a rule. Rules are typically exported
313
+ by another package, but can be defined locally. Custom rules are
314
+ identified by the
299
315
  [keyword `markdownlint-rule` on npm](https://www.npmjs.com/search?q=keywords:markdownlint-rule).
300
316
 
301
317
  Example:
@@ -307,7 +323,8 @@ const options = {
307
323
  };
308
324
  ```
309
325
 
310
- See [CustomRules.md](doc/CustomRules.md) for details about authoring custom rules.
326
+ See [CustomRules.md](doc/CustomRules.md) for details about authoring
327
+ custom rules.
311
328
 
312
329
  ##### options.files
313
330
 
@@ -316,8 +333,8 @@ Type: `Array` of `String`
316
333
  List of files to lint.
317
334
 
318
335
  Each array element should be a single file (via relative or absolute path);
319
- [globbing](https://en.wikipedia.org/wiki/Glob_%28programming%29) is the caller's
320
- responsibility.
336
+ [globbing](https://en.wikipedia.org/wiki/Glob_%28programming%29) is the
337
+ caller's responsibility.
321
338
 
322
339
  Example: `[ "one.md", "dir/two.md" ]`
323
340
 
@@ -327,9 +344,9 @@ Type: `Object` mapping `String` to `String`
327
344
 
328
345
  Map of identifiers to strings for linting.
329
346
 
330
- When Markdown content is not available as files, it can be passed as strings.
331
- The keys of the `strings` object are used to identify each input value in the
332
- `result` summary.
347
+ When Markdown content is not available as files, it can be passed as
348
+ strings. The keys of the `strings` object are used to identify each
349
+ input value in the `result` summary.
333
350
 
334
351
  Example:
335
352
 
@@ -349,12 +366,13 @@ Configures the rules to use.
349
366
  Object keys are rule names or aliases and values are the rule's configuration.
350
367
  The value `false` disables a rule, `true` enables its default configuration,
351
368
  and passing an object customizes its settings. Setting the special `default`
352
- rule to `true` or `false` includes/excludes all rules by default. Enabling or
353
- disabling a tag name (ex: `whitespace`) affects all rules having that tag.
369
+ rule to `true` or `false` includes/excludes all rules by default. Enabling
370
+ or disabling a tag name (ex: `whitespace`) affects all rules having that
371
+ tag.
354
372
 
355
- The `default` rule is applied first, then keys are processed in order from top
356
- to bottom with later values overriding earlier ones. Keys (including rule names,
357
- aliases, tags, and `default`) are not case-sensitive.
373
+ The `default` rule is applied first, then keys are processed in order
374
+ from top to bottom with later values overriding earlier ones. Keys
375
+ (including rule names, aliases, tags, and `default`) are not case-sensitive.
358
376
 
359
377
  Example:
360
378
 
@@ -368,8 +386,12 @@ Example:
368
386
  }
369
387
  ```
370
388
 
371
- Sets of rules (known as a "style") can be stored separately and loaded as
372
- [JSON](https://en.wikipedia.org/wiki/JSON).
389
+ See [.markdownlint.jsonc](schema/.markdownlint.jsonc) and/or
390
+ [.markdownlint.yaml](schema/.markdownlint.yaml) for an example
391
+ configuration object with all properties set to the default value.
392
+
393
+ Sets of rules (known as a "style") can be stored separately and loaded
394
+ as [JSON](https://en.wikipedia.org/wiki/JSON).
373
395
 
374
396
  Example:
375
397
 
@@ -383,10 +405,12 @@ const options = {
383
405
  See the [style](style) directory for more samples.
384
406
 
385
407
  See [markdownlint-config-schema.json](schema/markdownlint-config-schema.json)
386
- for the [JSON Schema](https://json-schema.org/) of the `options.config` object.
408
+ for the [JSON Schema](https://json-schema.org/) of the `options.config`
409
+ object.
387
410
 
388
- For more advanced scenarios, styles can reference and extend other styles. The
389
- `readConfig` and `readConfigSync` functions can be used to read such styles.
411
+ For more advanced scenarios, styles can reference and extend other styles.
412
+ The `readConfig` and `readConfigSync` functions can be used to read such
413
+ styles.
390
414
 
391
415
  For example, assuming a `base.json` configuration file:
392
416
 
@@ -428,12 +452,12 @@ const options = {
428
452
 
429
453
  Type: `RegExp`
430
454
 
431
- Matches any [front matter](https://jekyllrb.com/docs/frontmatter/) found at the
432
- beginning of a file.
455
+ Matches any [front matter](https://jekyllrb.com/docs/frontmatter/)
456
+ found at the beginning of a file.
433
457
 
434
- Some Markdown content begins with metadata; the default `RegExp` for this option
435
- ignores common forms of "front matter". To match differently, specify a custom
436
- `RegExp` or use the value `null` to disable the feature.
458
+ Some Markdown content begins with metadata; the default `RegExp` for
459
+ this option ignores common forms of "front matter". To match differently,
460
+ specify a custom `RegExp` or use the value `null` to disable the feature.
437
461
 
438
462
  The default value:
439
463
 
@@ -458,16 +482,16 @@ Note: Matches must occur at the start of the file.
458
482
 
459
483
  Type: `Boolean`
460
484
 
461
- Catches exceptions thrown during rule processing and reports the problem as a
462
- rule violation.
485
+ Catches exceptions thrown during rule processing and reports the problem
486
+ as a rule violation.
463
487
 
464
488
  By default, exceptions thrown by rules (or the library itself) are unhandled
465
489
  and bubble up the stack to the caller in the conventional manner. By setting
466
- `handleRuleFailures` to `true`, exceptions thrown by failing rules will be
467
- handled by the library and the exception message logged as a rule violation.
490
+ `handleRuleFailures` to `true`, exceptions thrown by failing rules will
491
+ be handled by the library and the exception message logged as a rule violation.
468
492
  This setting can be useful in the presence of (custom) rules that encounter
469
- unexpected syntax and fail. By enabling this option, the linting process is
470
- allowed to continue and report any violations that were found.
493
+ unexpected syntax and fail. By enabling this option, the linting process
494
+ is allowed to continue and report any violations that were found.
471
495
 
472
496
  ##### options.noInlineConfig
473
497
 
@@ -517,6 +541,16 @@ Each item in the top-level `Array` should be of the form:
517
541
  [ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
518
542
  ```
519
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
+
520
554
  #### callback
521
555
 
522
556
  Type: `Function` taking (`Error`, `Object`)
@@ -549,10 +583,11 @@ Asynchronous API:
549
583
  *
550
584
  * @param {string} file Configuration file name.
551
585
  * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s).
586
+ * @param {Object} [fs] File system implementation.
552
587
  * @param {ReadConfigCallback} [callback] Callback (err, result) function.
553
588
  * @returns {void}
554
589
  */
555
- function readConfig(file, parsers, callback) { ... }
590
+ function readConfig(file, parsers, fs, callback) { ... }
556
591
  ```
557
592
 
558
593
  Synchronous API:
@@ -563,13 +598,14 @@ Synchronous API:
563
598
  *
564
599
  * @param {string} file Configuration file name.
565
600
  * @param {ConfigurationParser[]} [parsers] Parsing function(s).
601
+ * @param {Object} [fs] File system implementation.
566
602
  * @returns {Configuration} Configuration object.
567
603
  */
568
- function readConfigSync(file, parsers) { ... }
604
+ function readConfigSync(file, parsers, fs) { ... }
569
605
  ```
570
606
 
571
607
  Promise API (in the `promises` namespace like Node.js's
572
- [`fs` Promises API](https://nodejs.org/api/fs.html#fs_fs_promises_api)):
608
+ [`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)):
573
609
 
574
610
  ```js
575
611
  /**
@@ -577,9 +613,10 @@ Promise API (in the `promises` namespace like Node.js's
577
613
  *
578
614
  * @param {string} file Configuration file name.
579
615
  * @param {ConfigurationParser[]} [parsers] Parsing function(s).
616
+ * @param {Object} [fs] File system implementation.
580
617
  * @returns {Promise<Configuration>} Configuration object.
581
618
  */
582
- function readConfig(file, parsers) { ... }
619
+ function readConfig(file, parsers, fs) { ... }
583
620
  ```
584
621
 
585
622
  #### file
@@ -607,9 +644,19 @@ should come before flexible parsers.
607
644
  For example:
608
645
 
609
646
  ```js
610
- [ JSON.parse, require("toml").parse, require("js-yaml").safeLoad ]
647
+ [ JSON.parse, require("toml").parse, require("js-yaml").load ]
611
648
  ```
612
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
+
613
660
  #### callback
614
661
 
615
662
  Type: `Function` taking (`Error`, `Object`)
@@ -650,11 +697,11 @@ Output:
650
697
  bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
651
698
  bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
652
699
  bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
653
- bad.string: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.string"]
700
+ bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.string"]
654
701
  bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
655
702
  bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
656
703
  bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
657
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
704
+ bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
658
705
  ```
659
706
 
660
707
  Or invoke `markdownlint.sync` for a synchronous call:
@@ -703,7 +750,7 @@ Output:
703
750
  "errorRange": [ 1, 2 ] },
704
751
  { "lineNumber": 1,
705
752
  "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
706
- "ruleDescription": "First line in file should be a top level heading",
753
+ "ruleDescription": "First line in a file should be a top-level heading",
707
754
  "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041",
708
755
  "errorDetail": null,
709
756
  "errorContext": "#bad.md",
@@ -742,7 +789,7 @@ Output:
742
789
  bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
743
790
  bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
744
791
  bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
745
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
792
+ bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
746
793
  [00:00:00] Finished 'markdownlint' after 10 ms
747
794
  ```
748
795
 
@@ -783,7 +830,7 @@ Warning:
783
830
  bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
784
831
  bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
785
832
  bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
786
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
833
+ bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
787
834
  Use --force to continue.
788
835
  ```
789
836
 
@@ -817,7 +864,8 @@ const results = window.markdownlint.sync(options).toString();
817
864
 
818
865
  ## Examples
819
866
 
820
- For ideas how to integrate `markdownlint` into your workflow, refer to the following projects:
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):
821
869
 
822
870
  * [.NET Documentation](https://docs.microsoft.com/en-us/dotnet/) ([Search repository](https://github.com/dotnet/docs/search?q=markdownlint))
823
871
  * [ally.js](https://allyjs.io/) ([Search repository](https://github.com/medialize/ally.js/search?q=markdownlint))
@@ -825,12 +873,13 @@ For ideas how to integrate `markdownlint` into your workflow, refer to the follo
825
873
  * [CodiMD](https://github.com/hackmdio/codimd) ([Search repository](https://github.com/hackmdio/codimd/search?q=markdownlint))
826
874
  * [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint))
827
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))
828
877
  * [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint))
829
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))
830
880
  * [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint))
831
881
  * [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint))
832
882
  * [TestCafe](https://devexpress.github.io/testcafe/) ([Search repository](https://github.com/DevExpress/testcafe/search?q=markdownlint))
833
- * [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) ([Search repository](https://github.com/Microsoft/TypeScript-Handbook/search?q=markdownlint))
834
883
  * [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint))
835
884
  * [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint))
836
885
  * [webpack](https://webpack.js.org/) ([Search repository](https://github.com/webpack/webpack.js.org/search?q=markdownlint))
@@ -919,10 +968,18 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
919
968
  * 0.22.0 - Allow `extends` in config to reference installed packages by name, add
920
969
  `markdownlint-disable-next-line` inline comment, support JSON front matter, improve
921
970
  MD009/MD026/MD028/MD043, update dependencies (including `markdown-it` to v12).
971
+ * 0.23.0 - Add comprehensive example `.markdownlint.jsonc`/`.markdownlint.yaml` files, add fix
972
+ information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve
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.
922
981
 
923
982
  [npm-image]: https://img.shields.io/npm/v/markdownlint.svg
924
983
  [npm-url]: https://www.npmjs.com/package/markdownlint
925
- [ci-image]: https://github.com/DavidAnson/markdownlint/workflows/CI/badge.svg?branch=main
926
- [ci-url]: https://github.com/DavidAnson/markdownlint/actions?query=branch%3Amain
927
984
  [license-image]: https://img.shields.io/npm/l/markdownlint.svg
928
985
  [license-url]: https://opensource.org/licenses/MIT