markdownlint 0.37.4 → 0.39.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/CHANGELOG.md +20 -0
- package/CONTRIBUTING.md +2 -3
- package/README.md +175 -87
- package/doc/Rules.md +273 -47
- package/doc/md001.md +14 -0
- package/doc/md009.md +8 -9
- package/doc/md010.md +6 -0
- package/doc/md027.md +8 -0
- package/doc/md029.md +2 -0
- package/doc/md033.md +7 -1
- package/doc/md038.md +23 -11
- package/doc/md041.md +31 -16
- package/doc/md043.md +22 -4
- package/doc/md045.md +9 -1
- package/doc/md051.md +17 -0
- package/doc/md052.md +12 -0
- package/doc/md053.md +3 -3
- package/doc/md055.md +1 -1
- package/doc/md056.md +1 -1
- package/doc/md059.md +33 -0
- package/doc/md060.md +70 -0
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +174 -20
- package/helpers/micromark-helpers.cjs +37 -7
- package/helpers/package.json +1 -1
- package/lib/cache.mjs +25 -7
- package/lib/configuration-strict.d.ts +1494 -292
- package/lib/constants.mjs +6 -5
- package/lib/defer-require.cjs +2 -0
- package/lib/exports.d.mts +2 -2
- package/lib/exports.mjs +2 -2
- package/lib/markdownit.cjs +8 -14
- package/lib/markdownlint.d.mts +136 -52
- package/lib/markdownlint.mjs +469 -409
- package/lib/md001.mjs +6 -2
- package/lib/md004.mjs +7 -18
- package/lib/md007.mjs +2 -1
- package/lib/md009.mjs +9 -5
- package/lib/md010.mjs +1 -1
- package/lib/md022.mjs +5 -2
- package/lib/md025.mjs +23 -15
- package/lib/md027.mjs +11 -1
- package/lib/md029.mjs +25 -14
- package/lib/md031.mjs +0 -1
- package/lib/md032.mjs +3 -1
- package/lib/md033.mjs +28 -20
- package/lib/md034.mjs +2 -1
- package/lib/md036.mjs +16 -4
- package/lib/md037.mjs +10 -7
- package/lib/md038.mjs +52 -71
- package/lib/md041.mjs +54 -16
- package/lib/md042.mjs +4 -2
- package/lib/md043.mjs +4 -2
- package/lib/md044.mjs +1 -1
- package/lib/md045.mjs +3 -1
- package/lib/md046.mjs +6 -6
- package/lib/md051.mjs +13 -5
- package/lib/md052.mjs +2 -1
- package/lib/md053.mjs +1 -1
- package/lib/md054.mjs +7 -5
- package/lib/md055.mjs +7 -6
- package/lib/md056.mjs +1 -1
- package/lib/md059.mjs +71 -0
- package/lib/md060.mjs +121 -0
- package/lib/micromark-parse.mjs +17 -3
- package/lib/node-imports-browser.mjs +2 -0
- package/lib/parse-configuration.mjs +47 -0
- package/lib/rules.mjs +5 -1
- package/package.json +32 -30
- package/schema/.markdownlint.jsonc +97 -62
- package/schema/.markdownlint.yaml +86 -57
- package/schema/markdownlint-config-schema-strict.json +4713 -1436
- package/schema/markdownlint-config-schema.json +4713 -1436
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.39.0
|
|
4
|
+
|
|
5
|
+
- Add MD060/table-column-style
|
|
6
|
+
- Improve MD001/MD007/MD009/MD010/MD029/MD033/MD037/MD059
|
|
7
|
+
- Add support for reporting violations as severity `warning`
|
|
8
|
+
- Deprecate `resultVersion` and `toString` (breaking change)
|
|
9
|
+
- Improve type definitions
|
|
10
|
+
- Improve demo web page
|
|
11
|
+
- Update dependencies
|
|
12
|
+
|
|
13
|
+
## 0.38.0
|
|
14
|
+
|
|
15
|
+
- Add MD059/descriptive-link-text
|
|
16
|
+
- Improve MD025/MD027/MD036/MD038/MD041/MD043/MD045/MD051/MD052
|
|
17
|
+
- `markdown-it` parser no longer a production dependency (breaking change)
|
|
18
|
+
- Add `markdownItFactory` option, remove `markdownItPlugins` option
|
|
19
|
+
- Remove support for end-of-life Node version 18
|
|
20
|
+
- Improve performance
|
|
21
|
+
- Update dependencies
|
|
22
|
+
|
|
3
23
|
## 0.37.4
|
|
4
24
|
|
|
5
25
|
- Stop using `module.createRequire`, export `resolveModule`
|
package/CONTRIBUTING.md
CHANGED
|
@@ -14,8 +14,8 @@ Match the coding style of the files you edit. Although everyone has their own
|
|
|
14
14
|
preferences and opinions, a pull request is not the right forum to debate them.
|
|
15
15
|
|
|
16
16
|
Do not add new [`dependencies` to `package.json`][dependencies]. The Markdown
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
parser [`micromark`][micromark] (and its extensions) is this project's only
|
|
18
|
+
dependency.
|
|
19
19
|
|
|
20
20
|
Package versions for `dependencies` and `devDependencies` should be specified
|
|
21
21
|
exactly (also known as "pinning"). The short explanation is that doing otherwise
|
|
@@ -85,7 +85,6 @@ Thank you!
|
|
|
85
85
|
[custom-rules]: doc/CustomRules.md
|
|
86
86
|
[dependencies]: https://docs.npmjs.com/files/package.json#dependencies
|
|
87
87
|
[example-com]: https://en.wikipedia.org/wiki/Example.com
|
|
88
|
-
[markdown-it]: https://www.npmjs.com/package/markdown-it
|
|
89
88
|
[micromark]: https://www.npmjs.com/package/micromark
|
|
90
89
|
[new-rule]: https://github.com/DavidAnson/markdownlint/labels/new%20rule
|
|
91
90
|
[npm-scripts]: https://docs.npmjs.com/misc/scripts
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ for Markdown files. It was inspired by - and heavily influenced by - Mark
|
|
|
24
24
|
Harrison's [markdownlint][markdownlint-ruby] for Ruby. The initial rules, rule
|
|
25
25
|
documentation, and test cases came from that project.
|
|
26
26
|
|
|
27
|
-
`markdownlint` uses the [`micromark`][micromark]
|
|
27
|
+
`markdownlint` uses the [`micromark` parser][micromark] and honors the
|
|
28
28
|
[CommonMark][commonmark] specification for Markdown. It additionally supports
|
|
29
29
|
popular [GitHub Flavored Markdown (GFM)][gfm] syntax like autolinks and tables
|
|
30
30
|
as well as directives, footnotes, and math syntax - all implemented by
|
|
@@ -55,6 +55,7 @@ as well as directives, footnotes, and math syntax - all implemented by
|
|
|
55
55
|
- [vscode-markdownlint extension for VS Code][vscode-markdownlint]
|
|
56
56
|
- [Sublime Text markdownlint for Sublime Text][sublimelinter]
|
|
57
57
|
- [coc-markdownlint extension for Vim/Neovim][coc]
|
|
58
|
+
- [flymake-markdownlint-cli2 extension for Emacs][emacs-flymake]
|
|
58
59
|
- Tooling
|
|
59
60
|
- [eslint-plugin-markdownlint for the ESLint analyzer][eslint-plugin]
|
|
60
61
|
- [grunt-markdownlint for the Grunt task runner][grunt-markdownlint]
|
|
@@ -65,6 +66,7 @@ as well as directives, footnotes, and math syntax - all implemented by
|
|
|
65
66
|
|
|
66
67
|
[cake]: https://github.com/cake-contrib/Cake.Markdownlint
|
|
67
68
|
[coc]: https://github.com/fannheyward/coc-markdownlint
|
|
69
|
+
[emacs-flymake]: https://github.com/ewilderj/flymake-markdownlint-cli2
|
|
68
70
|
[eslint-plugin]: https://github.com/paweldrozd/eslint-plugin-markdownlint
|
|
69
71
|
[grunt-markdownlint]: https://github.com/sagiegurari/grunt-markdownlint
|
|
70
72
|
[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
|
|
@@ -146,6 +148,8 @@ playground for learning and exploring.
|
|
|
146
148
|
- **[MD055](doc/md055.md)** *table-pipe-style* - Table pipe style
|
|
147
149
|
- **[MD056](doc/md056.md)** *table-column-count* - Table column count
|
|
148
150
|
- **[MD058](doc/md058.md)** *blanks-around-tables* - Tables should be surrounded by blank lines
|
|
151
|
+
- **[MD059](doc/md059.md)** *descriptive-link-text* - Link text should be descriptive
|
|
152
|
+
- **[MD060](doc/md060.md)** *table-column-style* - Table column style
|
|
149
153
|
|
|
150
154
|
<!-- markdownlint-restore -->
|
|
151
155
|
|
|
@@ -165,7 +169,7 @@ To implement your own rules, refer to [CustomRules.md](doc/CustomRules.md).
|
|
|
165
169
|
Tags group related rules and can be used to enable/disable multiple
|
|
166
170
|
rules at once.
|
|
167
171
|
|
|
168
|
-
- **`accessibility`** - `MD045`
|
|
172
|
+
- **`accessibility`** - `MD045`, `MD059`
|
|
169
173
|
- **`atx`** - `MD018`, `MD019`
|
|
170
174
|
- **`atx_closed`** - `MD020`, `MD021`
|
|
171
175
|
- **`blank_lines`** - `MD012`, `MD022`, `MD031`, `MD032`, `MD047`
|
|
@@ -183,11 +187,11 @@ rules at once.
|
|
|
183
187
|
- **`language`** - `MD040`
|
|
184
188
|
- **`line_length`** - `MD013`
|
|
185
189
|
- **`links`** - `MD011`, `MD034`, `MD039`, `MD042`, `MD051`, `MD052`, `MD053`,
|
|
186
|
-
`MD054`
|
|
190
|
+
`MD054`, `MD059`
|
|
187
191
|
- **`ol`** - `MD029`, `MD030`, `MD032`
|
|
188
192
|
- **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023`
|
|
189
193
|
- **`spelling`** - `MD044`
|
|
190
|
-
- **`table`** - `MD055`, `MD056`, `MD058`
|
|
194
|
+
- **`table`** - `MD055`, `MD056`, `MD058`, `MD060`
|
|
191
195
|
- **`ul`** - `MD004`, `MD005`, `MD007`, `MD030`, `MD032`
|
|
192
196
|
- **`url`** - `MD034`
|
|
193
197
|
- **`whitespace`** - `MD009`, `MD010`, `MD012`, `MD027`, `MD028`, `MD030`,
|
|
@@ -358,22 +362,118 @@ of `files` or `strings` should be set to provide input.
|
|
|
358
362
|
|
|
359
363
|
##### options.config
|
|
360
364
|
|
|
361
|
-
Type: `Object` mapping `String` to `Boolean | Object`
|
|
365
|
+
Type: `Object` mapping `String` to `Boolean | "error" | "warning" | Object`
|
|
362
366
|
|
|
363
367
|
Configures the rules to use.
|
|
364
368
|
|
|
365
369
|
Object keys are rule names/aliases; object values are the rule's configuration.
|
|
366
|
-
The value `false` disables a rule
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
The value `false` disables a rule. The values `true` or `"error"` enable a rule
|
|
371
|
+
in its default configuration and report violations as errors. The value
|
|
372
|
+
`"warning"` enables a rule in its default configuration and reports violations
|
|
373
|
+
as warnings. Passing an object enables *and* customizes the rule; the properties
|
|
374
|
+
`severity` (`"error" | "warning"`) and `enabled` (`false | true`) can be used in
|
|
375
|
+
this context. The special `default` rule assigns the default for all rules.
|
|
376
|
+
Using a tag name (e.g., `whitespace`) and a setting of `false`, `true`,
|
|
377
|
+
`"error"`, or `"warning"` applies that setting to all rules with that tag. When
|
|
378
|
+
no configuration object is passed or the optional `default` setting is not
|
|
379
|
+
present, all rules are enabled.
|
|
380
|
+
|
|
381
|
+
The following syntax disables the specified rule, tag, or `default`:
|
|
371
382
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
383
|
+
```javascript
|
|
384
|
+
{
|
|
385
|
+
"rule_tag_or_default": false
|
|
386
|
+
}
|
|
387
|
+
```
|
|
375
388
|
|
|
376
|
-
|
|
389
|
+
The following syntax enables the specified rule, tag, or `default` to report
|
|
390
|
+
violations as errors:
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
{
|
|
394
|
+
"rule_tag_or_default": true
|
|
395
|
+
// OR
|
|
396
|
+
"rule_tag_or_default": "error"
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
The following syntax enables the specified rule, tag, or `default` to report
|
|
401
|
+
violations as warnings:
|
|
402
|
+
|
|
403
|
+
```javascript
|
|
404
|
+
{
|
|
405
|
+
"rule_tag_or_default": "warning"
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
The following syntax enables and configures the specified rule to report
|
|
410
|
+
violations as errors:
|
|
411
|
+
|
|
412
|
+
```javascript
|
|
413
|
+
{
|
|
414
|
+
"rule": {
|
|
415
|
+
"severity": "error"
|
|
416
|
+
}
|
|
417
|
+
// OR
|
|
418
|
+
"rule": {
|
|
419
|
+
"rule_parameter": "value"
|
|
420
|
+
}
|
|
421
|
+
// OR
|
|
422
|
+
"rule": {
|
|
423
|
+
"severity": "error",
|
|
424
|
+
"rule_parameter": "value"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
The following syntax enables and configures the specified rule to report
|
|
430
|
+
violations as warnings:
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
{
|
|
434
|
+
"rule": {
|
|
435
|
+
"severity": "warning"
|
|
436
|
+
}
|
|
437
|
+
// OR
|
|
438
|
+
"rule": {
|
|
439
|
+
"severity": "warning",
|
|
440
|
+
"rule_parameter": "value"
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
> Note that values `"error"` and `"warning"` and the property `severity` are not
|
|
446
|
+
> supported by library versions earlier than `0.39.0`. However, the examples
|
|
447
|
+
> above behave the same there, with warnings being reported as errors.
|
|
448
|
+
|
|
449
|
+
The following syntax disables and configures the specified rule:
|
|
450
|
+
|
|
451
|
+
```javascript
|
|
452
|
+
{
|
|
453
|
+
"rule": {
|
|
454
|
+
"enabled": false,
|
|
455
|
+
"rule_parameter": "value"
|
|
456
|
+
}
|
|
457
|
+
// OR
|
|
458
|
+
"rule": {
|
|
459
|
+
"enabled": false,
|
|
460
|
+
"severity": "warning",
|
|
461
|
+
"rule_parameter": "value"
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
> Note that this example behaves **differently** with library versions earlier
|
|
467
|
+
> than `0.39.0` because the property `enabled` is not supported: it **enables**
|
|
468
|
+
> the rule instead of **disabling** it. As such, this syntax is discouraged when
|
|
469
|
+
> interoperability is important.
|
|
470
|
+
|
|
471
|
+
To evaluate a configuration object, the `default` setting is applied first, then
|
|
472
|
+
keys are processed in order from top to bottom. If multiple values apply to a
|
|
473
|
+
rule (because of tag names or duplication), later values override earlier ones.
|
|
474
|
+
Keys (including rule names, aliases, tags, or `default`) are not case-sensitive.
|
|
475
|
+
|
|
476
|
+
Example using `default`, rule names, and tag names together:
|
|
377
477
|
|
|
378
478
|
```json
|
|
379
479
|
{
|
|
@@ -418,9 +518,9 @@ object.
|
|
|
418
518
|
See [ValidatingConfiguration.md](schema/ValidatingConfiguration.md) for ways to
|
|
419
519
|
use the JSON Schema to validate configuration.
|
|
420
520
|
|
|
421
|
-
For more advanced scenarios, styles can reference and
|
|
422
|
-
|
|
423
|
-
styles.
|
|
521
|
+
For more advanced scenarios, styles can reference and build upon other styles
|
|
522
|
+
via the `extends` keyword and a file path or (installed) package name. The
|
|
523
|
+
`readConfig` function can be used to read such aggregate styles from code.
|
|
424
524
|
|
|
425
525
|
For example, assuming a `base.json` configuration file:
|
|
426
526
|
|
|
@@ -567,28 +667,43 @@ This setting can be useful in the presence of (custom) rules that encounter
|
|
|
567
667
|
unexpected syntax and fail. By enabling this option, the linting process
|
|
568
668
|
is allowed to continue and report any violations that were found.
|
|
569
669
|
|
|
570
|
-
##### options.
|
|
670
|
+
##### options.markdownItFactory
|
|
571
671
|
|
|
572
|
-
Type: `
|
|
672
|
+
Type: `Function` returning an instance of a [`markdown-it` parser][markdown-it]
|
|
573
673
|
|
|
574
|
-
|
|
575
|
-
parsing input. Plugins can be used to support additional syntax and features for
|
|
576
|
-
advanced scenarios. *Deprecated.*
|
|
674
|
+
Provides a factory function for creating instances of the `markdown-it` parser.
|
|
577
675
|
|
|
578
|
-
|
|
676
|
+
Previous versions of the `markdownlint` library declared `markdown-it` as a
|
|
677
|
+
direct dependency. This function makes it possible to avoid that dependency
|
|
678
|
+
entirely. In cases where `markdown-it` is needed, the caller is responsible for
|
|
679
|
+
declaring the dependency and returning an instance from this factory. If any
|
|
680
|
+
[`markdown-it` plugins][markdown-it-plugin] are needed, they should be `use`d by
|
|
681
|
+
the caller before returning the `markdown-it` instance.
|
|
682
|
+
|
|
683
|
+
For compatibility with previous versions of `markdownlint`, this function should
|
|
684
|
+
be similar to:
|
|
685
|
+
|
|
686
|
+
```javascript
|
|
687
|
+
import markdownIt from "markdown-it";
|
|
688
|
+
const markdownItFactory = () => markdownIt({ "html": true });
|
|
689
|
+
```
|
|
579
690
|
|
|
580
|
-
|
|
691
|
+
When an asynchronous implementation of `lint` is being invoked (e.g., via
|
|
692
|
+
`markdownlint/async` or `markdownlint/promise`), this function can return a
|
|
693
|
+
`Promise` in order to defer the import of `markdown-it`:
|
|
581
694
|
|
|
582
695
|
```javascript
|
|
583
|
-
|
|
696
|
+
const markdownItFactory = () => import("markdown-it").then((module) => module.default({ "html": true }));
|
|
584
697
|
```
|
|
585
698
|
|
|
586
|
-
> Note that
|
|
587
|
-
>
|
|
588
|
-
>
|
|
589
|
-
>
|
|
699
|
+
> Note that this function is only invoked when a `markdown-it` parser is
|
|
700
|
+
> needed. None of the built-in rules use the `markdown-it` parser, so it is only
|
|
701
|
+
> invoked when one or more [custom rules][custom-rules] are present that use the
|
|
702
|
+
> `markdown-it` parser.
|
|
590
703
|
|
|
591
704
|
[custom-rules]: #custom-rules
|
|
705
|
+
[markdown-it]: https://github.com/markdown-it/markdown-it
|
|
706
|
+
[markdown-it-plugin]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
|
|
592
707
|
|
|
593
708
|
##### options.noInlineConfig
|
|
594
709
|
|
|
@@ -601,28 +716,15 @@ By default, properly-formatted inline comments can be used to create exceptions
|
|
|
601
716
|
for parts of a document. Setting `noInlineConfig` to `true` ignores all such
|
|
602
717
|
comments.
|
|
603
718
|
|
|
604
|
-
##### options.resultVersion
|
|
605
|
-
|
|
606
|
-
Type: `Number`
|
|
607
|
-
|
|
608
|
-
Specifies which version of the `result` object to return (see the "Usage"
|
|
609
|
-
section below for examples).
|
|
719
|
+
##### ~~options.resultVersion~~
|
|
610
720
|
|
|
611
|
-
|
|
612
|
-
|
|
721
|
+
This property is *deprecated* and should be removed. The default format of the
|
|
722
|
+
`result` object remains the same as setting `resultVersion` to `3`. For
|
|
723
|
+
continued access to other (previously *deprecated*) formats:
|
|
613
724
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
Passing a `resultVersion` of `2` corresponds to a detailed format where each
|
|
619
|
-
error includes information about the line number, rule names, description, as
|
|
620
|
-
well as any additional detail or context that is available. *Deprecated*
|
|
621
|
-
|
|
622
|
-
Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
|
|
623
|
-
with additional information about how to fix automatically-fixable errors. In
|
|
624
|
-
this mode, all errors that occur on each line are reported (other versions
|
|
625
|
-
report only the first error for each rule). This is the default behavior.
|
|
725
|
+
```javascript
|
|
726
|
+
import { convertToResultVersion0, convertToResultVersion1, convertToResultVersion2 } from "markdownlint/helpers";
|
|
727
|
+
```
|
|
626
728
|
|
|
627
729
|
##### options.strings
|
|
628
730
|
|
|
@@ -653,16 +755,16 @@ Standard completion callback.
|
|
|
653
755
|
|
|
654
756
|
Type: `Object`
|
|
655
757
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
758
|
+
Map of input file names and string identifiers to issues within.
|
|
759
|
+
|
|
760
|
+
See the [Usage section](#usage) for an example of the structure of this object.
|
|
659
761
|
|
|
660
762
|
### Config
|
|
661
763
|
|
|
662
764
|
The `options.config` configuration object is simple and can be stored in a file
|
|
663
|
-
for readability and easy reuse. The `readConfig`
|
|
664
|
-
|
|
665
|
-
|
|
765
|
+
for readability and easy reuse. The `readConfig` function loads configuration
|
|
766
|
+
settings and supports the `extends` keyword for referencing files or packages
|
|
767
|
+
(see above).
|
|
666
768
|
|
|
667
769
|
By default, configuration files are parsed as JSON (and named
|
|
668
770
|
`.markdownlint.json`). Custom parsers can be provided to handle other formats
|
|
@@ -831,7 +933,7 @@ console.log(getVersion());
|
|
|
831
933
|
|
|
832
934
|
## Usage
|
|
833
935
|
|
|
834
|
-
Invoke `lint`
|
|
936
|
+
Invoke `lint` as an asynchronous call:
|
|
835
937
|
|
|
836
938
|
```javascript
|
|
837
939
|
import { lint as lintAsync } from "markdownlint/async";
|
|
@@ -846,34 +948,21 @@ const options = {
|
|
|
846
948
|
|
|
847
949
|
lintAsync(options, function callback(error, results) {
|
|
848
950
|
if (!error && results) {
|
|
849
|
-
console.
|
|
951
|
+
console.dir(results, { "colors": true, "depth": null });
|
|
850
952
|
}
|
|
851
953
|
});
|
|
852
954
|
```
|
|
853
955
|
|
|
854
|
-
Output:
|
|
855
|
-
|
|
856
|
-
```text
|
|
857
|
-
bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
|
|
858
|
-
bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
|
|
859
|
-
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
|
|
860
|
-
bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.string"]
|
|
861
|
-
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
|
|
862
|
-
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
|
|
863
|
-
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
|
|
864
|
-
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
|
|
865
|
-
```
|
|
866
|
-
|
|
867
956
|
Or as a synchronous call:
|
|
868
957
|
|
|
869
958
|
```javascript
|
|
870
959
|
import { lint as lintSync } from "markdownlint/sync";
|
|
871
960
|
|
|
872
961
|
const results = lintSync(options);
|
|
873
|
-
console.
|
|
962
|
+
console.dir(results, { "colors": true, "depth": null });
|
|
874
963
|
```
|
|
875
964
|
|
|
876
|
-
|
|
965
|
+
Or as a `Promise`-based call:
|
|
877
966
|
|
|
878
967
|
```javascript
|
|
879
968
|
import { lint as lintPromise } from "markdownlint/promise";
|
|
@@ -882,7 +971,7 @@ const results = await lintPromise(options);
|
|
|
882
971
|
console.dir(results, { "colors": true, "depth": null });
|
|
883
972
|
```
|
|
884
973
|
|
|
885
|
-
|
|
974
|
+
All of which return an object like:
|
|
886
975
|
|
|
887
976
|
```json
|
|
888
977
|
{
|
|
@@ -894,38 +983,40 @@ Output:
|
|
|
894
983
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md010.md",
|
|
895
984
|
"errorDetail": "Column: 17",
|
|
896
985
|
"errorContext": null,
|
|
897
|
-
"errorRange": [ 17, 1 ]
|
|
986
|
+
"errorRange": [ 17, 1 ],
|
|
987
|
+
"fixInfo": { "editColumn": 17, "deleteCount": 1, "insertText": " " },
|
|
988
|
+
"severity": "error" },
|
|
898
989
|
{ "lineNumber": 1,
|
|
899
990
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
900
991
|
"ruleDescription": "No space after hash on atx style heading",
|
|
901
992
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
|
|
902
993
|
"errorDetail": null,
|
|
903
994
|
"errorContext": "#bad.md",
|
|
904
|
-
"errorRange": [ 1, 2 ]
|
|
995
|
+
"errorRange": [ 1, 2 ],
|
|
996
|
+
"fixInfo": { "editColumn": 2, "insertText": " " },
|
|
997
|
+
"severity": "error" },
|
|
905
998
|
{ "lineNumber": 3,
|
|
906
999
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
907
1000
|
"ruleDescription": "No space after hash on atx style heading",
|
|
908
1001
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
|
|
909
1002
|
"errorDetail": null,
|
|
910
1003
|
"errorContext": "#This file fails\tsome rules.",
|
|
911
|
-
"errorRange": [ 1, 2 ]
|
|
1004
|
+
"errorRange": [ 1, 2 ],
|
|
1005
|
+
"fixInfo": { "editColumn": 2, "insertText": " " },
|
|
1006
|
+
"severity": "error" },
|
|
912
1007
|
{ "lineNumber": 1,
|
|
913
1008
|
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
914
1009
|
"ruleDescription": "First line in a file should be a top-level heading",
|
|
915
1010
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md",
|
|
916
1011
|
"errorDetail": null,
|
|
917
1012
|
"errorContext": "#bad.md",
|
|
918
|
-
"errorRange": null
|
|
1013
|
+
"errorRange": null,
|
|
1014
|
+
"fixInfo": null,
|
|
1015
|
+
"severity": "error" }
|
|
919
1016
|
]
|
|
920
1017
|
}
|
|
921
1018
|
```
|
|
922
1019
|
|
|
923
|
-
Integration with the [gulp](https://gulpjs.com/) build system is
|
|
924
|
-
straightforward: [`gulpfile.cjs`](example/gulpfile.cjs).
|
|
925
|
-
|
|
926
|
-
Integration with the [Grunt](https://gruntjs.com/) build system is similar:
|
|
927
|
-
[`Gruntfile.cjs`](example/Gruntfile.cjs).
|
|
928
|
-
|
|
929
1020
|
## Browser
|
|
930
1021
|
|
|
931
1022
|
`markdownlint` also works in the browser.
|
|
@@ -951,7 +1042,7 @@ const options = {
|
|
|
951
1042
|
}
|
|
952
1043
|
};
|
|
953
1044
|
|
|
954
|
-
const results = globalThis.markdownlint.lintSync(options)
|
|
1045
|
+
const results = globalThis.markdownlint.lintSync(options);
|
|
955
1046
|
```
|
|
956
1047
|
|
|
957
1048
|
## Examples
|
|
@@ -962,7 +1053,6 @@ following projects or one of the tools in the [Related section](#related):
|
|
|
962
1053
|
- [.NET Documentation][dot-net-doc] ([Search repository][dot-net-doc-search])
|
|
963
1054
|
- [ally.js][ally-js] ([Search repository][ally-js-search])
|
|
964
1055
|
- [Apache Airflow][airflow] ([Search repository][airflow-search])
|
|
965
|
-
- [Boostnote][boostnote] ([Search repository][boostnote-search])
|
|
966
1056
|
- [CodiMD][codimd] ([Search repository][codimd-search])
|
|
967
1057
|
- [Electron][electron] ([Search repository][electron-search])
|
|
968
1058
|
- [ESLint][eslint] ([Search repository][eslint-search])
|
|
@@ -986,8 +1076,6 @@ For more advanced integration scenarios:
|
|
|
986
1076
|
[ally-js-search]: https://github.com/medialize/ally.js/search?q=markdownlint
|
|
987
1077
|
[airflow]: https://airflow.apache.org
|
|
988
1078
|
[airflow-search]: https://github.com/apache/airflow/search?q=markdownlint
|
|
989
|
-
[boostnote]: https://boostnote.io/
|
|
990
|
-
[boostnote-search]: https://github.com/BoostIO/Boostnote/search?q=markdownlint
|
|
991
1079
|
[codimd]: https://github.com/hackmdio/codimd
|
|
992
1080
|
[codimd-search]: https://github.com/hackmdio/codimd/search?q=markdownlint
|
|
993
1081
|
[content-linter]: https://docs.github.com/en/contributing/collaborating-on-github-docs/using-the-content-linter
|