markdownlint 0.38.0 → 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 +10 -0
- package/README.md +136 -66
- package/doc/Rules.md +116 -13
- package/doc/md001.md +14 -0
- package/doc/md009.md +8 -9
- package/doc/md010.md +6 -0
- package/doc/md029.md +2 -0
- package/doc/md033.md +7 -1
- package/doc/md055.md +1 -1
- package/doc/md056.md +1 -1
- package/doc/md059.md +4 -1
- package/doc/md060.md +70 -0
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +171 -15
- package/helpers/micromark-helpers.cjs +11 -7
- package/helpers/package.json +1 -1
- package/lib/cache.mjs +6 -2
- package/lib/configuration-strict.d.ts +1344 -206
- package/lib/constants.mjs +6 -5
- package/lib/defer-require.cjs +2 -0
- package/lib/exports.d.mts +1 -2
- package/lib/exports.mjs +1 -2
- package/lib/markdownit.cjs +2 -1
- package/lib/markdownlint.d.mts +101 -51
- package/lib/markdownlint.mjs +217 -181
- 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/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 +5 -3
- package/lib/md037.mjs +10 -7
- package/lib/md042.mjs +4 -2
- package/lib/md043.mjs +2 -2
- package/lib/md044.mjs +1 -1
- package/lib/md046.mjs +6 -6
- 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/md060.mjs +121 -0
- package/lib/micromark-parse.mjs +3 -0
- package/lib/node-imports-browser.mjs +2 -0
- package/lib/parse-configuration.mjs +5 -4
- package/lib/rules.mjs +3 -1
- package/package.json +15 -16
- package/schema/.markdownlint.jsonc +67 -54
- package/schema/.markdownlint.yaml +64 -53
- package/schema/markdownlint-config-schema-strict.json +4699 -1537
- package/schema/markdownlint-config-schema.json +4699 -1537
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
|
|
3
13
|
## 0.38.0
|
|
4
14
|
|
|
5
15
|
- Add MD059/descriptive-link-text
|
package/README.md
CHANGED
|
@@ -149,6 +149,7 @@ playground for learning and exploring.
|
|
|
149
149
|
- **[MD056](doc/md056.md)** *table-column-count* - Table column count
|
|
150
150
|
- **[MD058](doc/md058.md)** *blanks-around-tables* - Tables should be surrounded by blank lines
|
|
151
151
|
- **[MD059](doc/md059.md)** *descriptive-link-text* - Link text should be descriptive
|
|
152
|
+
- **[MD060](doc/md060.md)** *table-column-style* - Table column style
|
|
152
153
|
|
|
153
154
|
<!-- markdownlint-restore -->
|
|
154
155
|
|
|
@@ -190,7 +191,7 @@ rules at once.
|
|
|
190
191
|
- **`ol`** - `MD029`, `MD030`, `MD032`
|
|
191
192
|
- **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023`
|
|
192
193
|
- **`spelling`** - `MD044`
|
|
193
|
-
- **`table`** - `MD055`, `MD056`, `MD058`
|
|
194
|
+
- **`table`** - `MD055`, `MD056`, `MD058`, `MD060`
|
|
194
195
|
- **`ul`** - `MD004`, `MD005`, `MD007`, `MD030`, `MD032`
|
|
195
196
|
- **`url`** - `MD034`
|
|
196
197
|
- **`whitespace`** - `MD009`, `MD010`, `MD012`, `MD027`, `MD028`, `MD030`,
|
|
@@ -361,22 +362,118 @@ of `files` or `strings` should be set to provide input.
|
|
|
361
362
|
|
|
362
363
|
##### options.config
|
|
363
364
|
|
|
364
|
-
Type: `Object` mapping `String` to `Boolean | Object`
|
|
365
|
+
Type: `Object` mapping `String` to `Boolean | "error" | "warning" | Object`
|
|
365
366
|
|
|
366
367
|
Configures the rules to use.
|
|
367
368
|
|
|
368
369
|
Object keys are rule names/aliases; object values are the rule's configuration.
|
|
369
|
-
The value `false` disables a rule
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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`:
|
|
374
382
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
383
|
+
```javascript
|
|
384
|
+
{
|
|
385
|
+
"rule_tag_or_default": false
|
|
386
|
+
}
|
|
387
|
+
```
|
|
378
388
|
|
|
379
|
-
|
|
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:
|
|
380
477
|
|
|
381
478
|
```json
|
|
382
479
|
{
|
|
@@ -619,28 +716,15 @@ By default, properly-formatted inline comments can be used to create exceptions
|
|
|
619
716
|
for parts of a document. Setting `noInlineConfig` to `true` ignores all such
|
|
620
717
|
comments.
|
|
621
718
|
|
|
622
|
-
##### options.resultVersion
|
|
719
|
+
##### ~~options.resultVersion~~
|
|
623
720
|
|
|
624
|
-
|
|
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:
|
|
625
724
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
Passing a `resultVersion` of `0` corresponds to the original, simple format
|
|
630
|
-
where each error is identified by rule name and line number. *Deprecated*
|
|
631
|
-
|
|
632
|
-
Passing a `resultVersion` of `1` corresponds to a detailed format where each
|
|
633
|
-
error includes information about the line number, rule name, alias, description,
|
|
634
|
-
as well as any additional detail or context that is available. *Deprecated*
|
|
635
|
-
|
|
636
|
-
Passing a `resultVersion` of `2` corresponds to a detailed format where each
|
|
637
|
-
error includes information about the line number, rule names, description, as
|
|
638
|
-
well as any additional detail or context that is available. *Deprecated*
|
|
639
|
-
|
|
640
|
-
Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
|
|
641
|
-
with additional information about how to fix automatically-fixable errors. In
|
|
642
|
-
this mode, all errors that occur on each line are reported (other versions
|
|
643
|
-
report only the first error for each rule). This is the default behavior.
|
|
725
|
+
```javascript
|
|
726
|
+
import { convertToResultVersion0, convertToResultVersion1, convertToResultVersion2 } from "markdownlint/helpers";
|
|
727
|
+
```
|
|
644
728
|
|
|
645
729
|
##### options.strings
|
|
646
730
|
|
|
@@ -671,9 +755,9 @@ Standard completion callback.
|
|
|
671
755
|
|
|
672
756
|
Type: `Object`
|
|
673
757
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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.
|
|
677
761
|
|
|
678
762
|
### Config
|
|
679
763
|
|
|
@@ -849,7 +933,7 @@ console.log(getVersion());
|
|
|
849
933
|
|
|
850
934
|
## Usage
|
|
851
935
|
|
|
852
|
-
Invoke `lint`
|
|
936
|
+
Invoke `lint` as an asynchronous call:
|
|
853
937
|
|
|
854
938
|
```javascript
|
|
855
939
|
import { lint as lintAsync } from "markdownlint/async";
|
|
@@ -864,34 +948,21 @@ const options = {
|
|
|
864
948
|
|
|
865
949
|
lintAsync(options, function callback(error, results) {
|
|
866
950
|
if (!error && results) {
|
|
867
|
-
console.
|
|
951
|
+
console.dir(results, { "colors": true, "depth": null });
|
|
868
952
|
}
|
|
869
953
|
});
|
|
870
954
|
```
|
|
871
955
|
|
|
872
|
-
Output:
|
|
873
|
-
|
|
874
|
-
```text
|
|
875
|
-
bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
|
|
876
|
-
bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
|
|
877
|
-
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
|
|
878
|
-
bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.string"]
|
|
879
|
-
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
|
|
880
|
-
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
|
|
881
|
-
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
|
|
882
|
-
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
|
|
883
|
-
```
|
|
884
|
-
|
|
885
956
|
Or as a synchronous call:
|
|
886
957
|
|
|
887
958
|
```javascript
|
|
888
959
|
import { lint as lintSync } from "markdownlint/sync";
|
|
889
960
|
|
|
890
961
|
const results = lintSync(options);
|
|
891
|
-
console.
|
|
962
|
+
console.dir(results, { "colors": true, "depth": null });
|
|
892
963
|
```
|
|
893
964
|
|
|
894
|
-
|
|
965
|
+
Or as a `Promise`-based call:
|
|
895
966
|
|
|
896
967
|
```javascript
|
|
897
968
|
import { lint as lintPromise } from "markdownlint/promise";
|
|
@@ -900,7 +971,7 @@ const results = await lintPromise(options);
|
|
|
900
971
|
console.dir(results, { "colors": true, "depth": null });
|
|
901
972
|
```
|
|
902
973
|
|
|
903
|
-
|
|
974
|
+
All of which return an object like:
|
|
904
975
|
|
|
905
976
|
```json
|
|
906
977
|
{
|
|
@@ -912,38 +983,40 @@ Output:
|
|
|
912
983
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md010.md",
|
|
913
984
|
"errorDetail": "Column: 17",
|
|
914
985
|
"errorContext": null,
|
|
915
|
-
"errorRange": [ 17, 1 ]
|
|
986
|
+
"errorRange": [ 17, 1 ],
|
|
987
|
+
"fixInfo": { "editColumn": 17, "deleteCount": 1, "insertText": " " },
|
|
988
|
+
"severity": "error" },
|
|
916
989
|
{ "lineNumber": 1,
|
|
917
990
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
918
991
|
"ruleDescription": "No space after hash on atx style heading",
|
|
919
992
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
|
|
920
993
|
"errorDetail": null,
|
|
921
994
|
"errorContext": "#bad.md",
|
|
922
|
-
"errorRange": [ 1, 2 ]
|
|
995
|
+
"errorRange": [ 1, 2 ],
|
|
996
|
+
"fixInfo": { "editColumn": 2, "insertText": " " },
|
|
997
|
+
"severity": "error" },
|
|
923
998
|
{ "lineNumber": 3,
|
|
924
999
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
925
1000
|
"ruleDescription": "No space after hash on atx style heading",
|
|
926
1001
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
|
|
927
1002
|
"errorDetail": null,
|
|
928
1003
|
"errorContext": "#This file fails\tsome rules.",
|
|
929
|
-
"errorRange": [ 1, 2 ]
|
|
1004
|
+
"errorRange": [ 1, 2 ],
|
|
1005
|
+
"fixInfo": { "editColumn": 2, "insertText": " " },
|
|
1006
|
+
"severity": "error" },
|
|
930
1007
|
{ "lineNumber": 1,
|
|
931
1008
|
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
932
1009
|
"ruleDescription": "First line in a file should be a top-level heading",
|
|
933
1010
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md",
|
|
934
1011
|
"errorDetail": null,
|
|
935
1012
|
"errorContext": "#bad.md",
|
|
936
|
-
"errorRange": null
|
|
1013
|
+
"errorRange": null,
|
|
1014
|
+
"fixInfo": null,
|
|
1015
|
+
"severity": "error" }
|
|
937
1016
|
]
|
|
938
1017
|
}
|
|
939
1018
|
```
|
|
940
1019
|
|
|
941
|
-
Integration with the [gulp](https://gulpjs.com/) build system is
|
|
942
|
-
straightforward: [`gulpfile.cjs`](example/gulpfile.cjs).
|
|
943
|
-
|
|
944
|
-
Integration with the [Grunt](https://gruntjs.com/) build system is similar:
|
|
945
|
-
[`Gruntfile.cjs`](example/Gruntfile.cjs).
|
|
946
|
-
|
|
947
1020
|
## Browser
|
|
948
1021
|
|
|
949
1022
|
`markdownlint` also works in the browser.
|
|
@@ -969,7 +1042,7 @@ const options = {
|
|
|
969
1042
|
}
|
|
970
1043
|
};
|
|
971
1044
|
|
|
972
|
-
const results = globalThis.markdownlint.lintSync(options)
|
|
1045
|
+
const results = globalThis.markdownlint.lintSync(options);
|
|
973
1046
|
```
|
|
974
1047
|
|
|
975
1048
|
## Examples
|
|
@@ -980,7 +1053,6 @@ following projects or one of the tools in the [Related section](#related):
|
|
|
980
1053
|
- [.NET Documentation][dot-net-doc] ([Search repository][dot-net-doc-search])
|
|
981
1054
|
- [ally.js][ally-js] ([Search repository][ally-js-search])
|
|
982
1055
|
- [Apache Airflow][airflow] ([Search repository][airflow-search])
|
|
983
|
-
- [Boostnote][boostnote] ([Search repository][boostnote-search])
|
|
984
1056
|
- [CodiMD][codimd] ([Search repository][codimd-search])
|
|
985
1057
|
- [Electron][electron] ([Search repository][electron-search])
|
|
986
1058
|
- [ESLint][eslint] ([Search repository][eslint-search])
|
|
@@ -1004,8 +1076,6 @@ For more advanced integration scenarios:
|
|
|
1004
1076
|
[ally-js-search]: https://github.com/medialize/ally.js/search?q=markdownlint
|
|
1005
1077
|
[airflow]: https://airflow.apache.org
|
|
1006
1078
|
[airflow-search]: https://github.com/apache/airflow/search?q=markdownlint
|
|
1007
|
-
[boostnote]: https://boostnote.io/
|
|
1008
|
-
[boostnote-search]: https://github.com/BoostIO/Boostnote/search?q=markdownlint
|
|
1009
1079
|
[codimd]: https://github.com/hackmdio/codimd
|
|
1010
1080
|
[codimd-search]: https://github.com/hackmdio/codimd/search?q=markdownlint
|
|
1011
1081
|
[content-linter]: https://docs.github.com/en/contributing/collaborating-on-github-docs/using-the-content-linter
|
package/doc/Rules.md
CHANGED
|
@@ -12,6 +12,11 @@ Tags: `headings`
|
|
|
12
12
|
|
|
13
13
|
Aliases: `heading-increment`
|
|
14
14
|
|
|
15
|
+
Parameters:
|
|
16
|
+
|
|
17
|
+
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
18
|
+
default `^\s*title\s*[:=]`)
|
|
19
|
+
|
|
15
20
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
16
21
|
example:
|
|
17
22
|
|
|
@@ -40,6 +45,15 @@ level at a time:
|
|
|
40
45
|
### Another Heading 3
|
|
41
46
|
```
|
|
42
47
|
|
|
48
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
49
|
+
contains a `title` property (commonly used with blog posts), this rule treats
|
|
50
|
+
that as a top level heading and will report a violation if the actual first
|
|
51
|
+
heading is not a level 2 heading. To use a different property name in the
|
|
52
|
+
front matter, specify the text of a regular expression via the
|
|
53
|
+
`front_matter_title` parameter. To disable the use of front matter by this
|
|
54
|
+
rule, specify `""` for `front_matter_title`. When front matter is not present,
|
|
55
|
+
the first heading can be any level.
|
|
56
|
+
|
|
43
57
|
Rationale: Headings represent the structure of a document and can be confusing
|
|
44
58
|
when skipped - especially for accessibility scenarios. More information:
|
|
45
59
|
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
|
@@ -281,6 +295,7 @@ Aliases: `no-trailing-spaces`
|
|
|
281
295
|
Parameters:
|
|
282
296
|
|
|
283
297
|
- `br_spaces`: Spaces for line break (`integer`, default `2`)
|
|
298
|
+
- `code_blocks`: Include code blocks (`boolean`, default `false`)
|
|
284
299
|
- `list_item_empty_lines`: Allow spaces for empty lines in list items
|
|
285
300
|
(`boolean`, default `false`)
|
|
286
301
|
- `strict`: Include unnecessary breaks (`boolean`, default `false`)
|
|
@@ -290,21 +305,19 @@ Fixable: Some violations can be fixed by tooling
|
|
|
290
305
|
This rule is triggered on any lines that end with unexpected whitespace. To fix
|
|
291
306
|
this, remove the trailing space from the end of the line.
|
|
292
307
|
|
|
293
|
-
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
294
|
-
languages require it.
|
|
295
|
-
|
|
296
308
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
297
309
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
298
|
-
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
310
|
+
value allows 2 spaces to indicate a hard break (\<br> element). (You must set
|
|
311
|
+
`br_spaces` to a value >= 2 for this parameter to take effect. Setting
|
|
312
|
+
`br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.)
|
|
299
313
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
314
|
+
By default, trailing space is allowed in indented and fenced code blocks because
|
|
315
|
+
some programming languages require that. To report such instances, set the
|
|
316
|
+
`code_blocks` parameter to `true`.
|
|
303
317
|
|
|
304
318
|
By default, this rule will not trigger when the allowed number of spaces is
|
|
305
319
|
used, even when it doesn't create a hard break (for example, at the end of a
|
|
306
|
-
paragraph). To report such instances
|
|
307
|
-
`true`.
|
|
320
|
+
paragraph). To report such instances, set the `strict` parameter to `true`.
|
|
308
321
|
|
|
309
322
|
```markdown
|
|
310
323
|
Text text text
|
|
@@ -383,6 +396,12 @@ parameter to the desired value.
|
|
|
383
396
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
384
397
|
can be harder to work with than spaces.
|
|
385
398
|
|
|
399
|
+
More information:
|
|
400
|
+
|
|
401
|
+
- <https://agiletribe.wordpress.com/2011/10/27/18-dont-use-tab-characters/>
|
|
402
|
+
- <https://www.jwz.org/doc/tabs-vs-spaces.html>
|
|
403
|
+
- <https://adamspiers.org/computing/why_no_tabs.html>
|
|
404
|
+
|
|
386
405
|
<a name="md011"></a>
|
|
387
406
|
|
|
388
407
|
## `MD011` - Reversed link syntax
|
|
@@ -1026,6 +1045,8 @@ Parameters:
|
|
|
1026
1045
|
- `style`: List style (`string`, default `one_or_ordered`, values `one` /
|
|
1027
1046
|
`one_or_ordered` / `ordered` / `zero`)
|
|
1028
1047
|
|
|
1048
|
+
Fixable: Some violations can be fixed by tooling
|
|
1049
|
+
|
|
1029
1050
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
1030
1051
|
do not have a prefix that increases in numerical order (depending on the
|
|
1031
1052
|
configured style). The less-common pattern of using '0.' as a first prefix or
|
|
@@ -1321,6 +1342,8 @@ Aliases: `no-inline-html`
|
|
|
1321
1342
|
Parameters:
|
|
1322
1343
|
|
|
1323
1344
|
- `allowed_elements`: Allowed elements (`string[]`, default `[]`)
|
|
1345
|
+
- `table_allowed_elements`: Allowed elements in tables (`string[]`, default
|
|
1346
|
+
`[]`)
|
|
1324
1347
|
|
|
1325
1348
|
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
1326
1349
|
|
|
@@ -1334,7 +1357,11 @@ To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
|
1334
1357
|
# Markdown heading
|
|
1335
1358
|
```
|
|
1336
1359
|
|
|
1337
|
-
|
|
1360
|
+
To allow specific HTML elements anywhere in Markdown content, set the
|
|
1361
|
+
`allowed_elements` parameter to a list of HTML element names. To allow a
|
|
1362
|
+
specific set of HTML elements within Markdown tables, set the
|
|
1363
|
+
`table_allowed_elements` parameter to a list of HTML element names. This can be
|
|
1364
|
+
used to permit the use of `<br>`-style line breaks only within Markdown tables.
|
|
1338
1365
|
|
|
1339
1366
|
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
1340
1367
|
those who want their documents to only include "pure" Markdown, or for those
|
|
@@ -2523,7 +2550,7 @@ Rationale: Some parsers have difficulty with tables that are missing their
|
|
|
2523
2550
|
leading or trailing pipe characters. The use of leading/trailing pipes can also
|
|
2524
2551
|
help provide visual clarity.
|
|
2525
2552
|
|
|
2526
|
-
[gfm-table-055]: https://
|
|
2553
|
+
[gfm-table-055]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2527
2554
|
|
|
2528
2555
|
<a name="md056"></a>
|
|
2529
2556
|
|
|
@@ -2563,7 +2590,7 @@ of cells or it will not be recognized as a table (per specification).
|
|
|
2563
2590
|
Rationale: Extra cells in a row are usually not shown, so their data is lost.
|
|
2564
2591
|
Missing cells in a row create holes in the table and suggest an omission.
|
|
2565
2592
|
|
|
2566
|
-
[gfm-table-056]: https://
|
|
2593
|
+
[gfm-table-056]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2567
2594
|
|
|
2568
2595
|
<a name="md058"></a>
|
|
2569
2596
|
|
|
@@ -2647,7 +2674,83 @@ translations for every language.
|
|
|
2647
2674
|
|
|
2648
2675
|
Note: This rule checks Markdown links; HTML links are ignored.
|
|
2649
2676
|
|
|
2650
|
-
More information:
|
|
2677
|
+
More information:
|
|
2678
|
+
|
|
2679
|
+
- <https://webaim.org/techniques/hypertext/>
|
|
2680
|
+
- <https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html>
|
|
2681
|
+
|
|
2682
|
+
<a name="md060"></a>
|
|
2683
|
+
|
|
2684
|
+
## `MD060` - Table column style
|
|
2685
|
+
|
|
2686
|
+
Tags: `table`
|
|
2687
|
+
|
|
2688
|
+
Aliases: `table-column-style`
|
|
2689
|
+
|
|
2690
|
+
Parameters:
|
|
2691
|
+
|
|
2692
|
+
- `style`: Table column style (`string`, default `any`, values `aligned` /
|
|
2693
|
+
`any` / `compact` / `tight`)
|
|
2694
|
+
|
|
2695
|
+
This rule is triggered when the column separators of a
|
|
2696
|
+
[GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
|
|
2697
|
+
|
|
2698
|
+
This rule recognizes three table column styles based on popular use:
|
|
2699
|
+
|
|
2700
|
+
Style `aligned` looks the most like a table:
|
|
2701
|
+
|
|
2702
|
+
```markdown
|
|
2703
|
+
| Character | Meaning |
|
|
2704
|
+
| --------- | ------- |
|
|
2705
|
+
| Y | Yes |
|
|
2706
|
+
| N | No |
|
|
2707
|
+
```
|
|
2708
|
+
|
|
2709
|
+
Style `compact` uses a single space to pad cell content:
|
|
2710
|
+
|
|
2711
|
+
```markdown
|
|
2712
|
+
| Character | Meaning |
|
|
2713
|
+
| --- | --- |
|
|
2714
|
+
| Y | Yes |
|
|
2715
|
+
| N | No |
|
|
2716
|
+
```
|
|
2717
|
+
|
|
2718
|
+
Style `tight` uses no padding for cell content:
|
|
2719
|
+
|
|
2720
|
+
```markdown
|
|
2721
|
+
|Character|Meaning|
|
|
2722
|
+
|---|---|
|
|
2723
|
+
|Y|Yes|
|
|
2724
|
+
|N|No|
|
|
2725
|
+
```
|
|
2726
|
+
|
|
2727
|
+
When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
|
|
2728
|
+
every table must match the corresponding pattern and errors will be reported for
|
|
2729
|
+
any violations. By default, or when the `any` style is used, each table is
|
|
2730
|
+
analyzed to see if it satisfies any supported style. If so, no errors are
|
|
2731
|
+
reported. If not, errors are be reported for whichever style would produce the
|
|
2732
|
+
*fewest* errors (i.e., whichever style is the closest match).
|
|
2733
|
+
|
|
2734
|
+
Note: Pipe alignment for the `aligned` style is based on character count, so
|
|
2735
|
+
wide characters and multi-character encodings can produce unexpected results.
|
|
2736
|
+
The following table is correctly aligned based on character count, though some
|
|
2737
|
+
editors render the emoji wider:
|
|
2738
|
+
|
|
2739
|
+
<!-- markdownlint-capture -->
|
|
2740
|
+
<!-- markdownlint-disable extended-ascii -->
|
|
2741
|
+
|
|
2742
|
+
```markdown
|
|
2743
|
+
| Response | Emoji |
|
|
2744
|
+
| -------- | ----- |
|
|
2745
|
+
| Yes | ✅ |
|
|
2746
|
+
| No | ❎ |
|
|
2747
|
+
```
|
|
2748
|
+
|
|
2749
|
+
<!-- markdownlint-restore -->
|
|
2750
|
+
|
|
2751
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2752
|
+
|
|
2753
|
+
[gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2651
2754
|
|
|
2652
2755
|
<!-- markdownlint-configure-file {
|
|
2653
2756
|
"no-inline-html": {
|
package/doc/md001.md
CHANGED
|
@@ -4,6 +4,11 @@ Tags: `headings`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `heading-increment`
|
|
6
6
|
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
10
|
+
default `^\s*title\s*[:=]`)
|
|
11
|
+
|
|
7
12
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
8
13
|
example:
|
|
9
14
|
|
|
@@ -32,6 +37,15 @@ level at a time:
|
|
|
32
37
|
### Another Heading 3
|
|
33
38
|
```
|
|
34
39
|
|
|
40
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
41
|
+
contains a `title` property (commonly used with blog posts), this rule treats
|
|
42
|
+
that as a top level heading and will report a violation if the actual first
|
|
43
|
+
heading is not a level 2 heading. To use a different property name in the
|
|
44
|
+
front matter, specify the text of a regular expression via the
|
|
45
|
+
`front_matter_title` parameter. To disable the use of front matter by this
|
|
46
|
+
rule, specify `""` for `front_matter_title`. When front matter is not present,
|
|
47
|
+
the first heading can be any level.
|
|
48
|
+
|
|
35
49
|
Rationale: Headings represent the structure of a document and can be confusing
|
|
36
50
|
when skipped - especially for accessibility scenarios. More information:
|
|
37
51
|
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
package/doc/md009.md
CHANGED
|
@@ -7,6 +7,7 @@ Aliases: `no-trailing-spaces`
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
9
|
- `br_spaces`: Spaces for line break (`integer`, default `2`)
|
|
10
|
+
- `code_blocks`: Include code blocks (`boolean`, default `false`)
|
|
10
11
|
- `list_item_empty_lines`: Allow spaces for empty lines in list items
|
|
11
12
|
(`boolean`, default `false`)
|
|
12
13
|
- `strict`: Include unnecessary breaks (`boolean`, default `false`)
|
|
@@ -16,21 +17,19 @@ Fixable: Some violations can be fixed by tooling
|
|
|
16
17
|
This rule is triggered on any lines that end with unexpected whitespace. To fix
|
|
17
18
|
this, remove the trailing space from the end of the line.
|
|
18
19
|
|
|
19
|
-
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
20
|
-
languages require it.
|
|
21
|
-
|
|
22
20
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
23
21
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
24
|
-
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
22
|
+
value allows 2 spaces to indicate a hard break (\<br> element). (You must set
|
|
23
|
+
`br_spaces` to a value >= 2 for this parameter to take effect. Setting
|
|
24
|
+
`br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
By default, trailing space is allowed in indented and fenced code blocks because
|
|
27
|
+
some programming languages require that. To report such instances, set the
|
|
28
|
+
`code_blocks` parameter to `true`.
|
|
29
29
|
|
|
30
30
|
By default, this rule will not trigger when the allowed number of spaces is
|
|
31
31
|
used, even when it doesn't create a hard break (for example, at the end of a
|
|
32
|
-
paragraph). To report such instances
|
|
33
|
-
`true`.
|
|
32
|
+
paragraph). To report such instances, set the `strict` parameter to `true`.
|
|
34
33
|
|
|
35
34
|
```markdown
|
|
36
35
|
Text text text
|
package/doc/md010.md
CHANGED
|
@@ -54,3 +54,9 @@ parameter to the desired value.
|
|
|
54
54
|
|
|
55
55
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
56
56
|
can be harder to work with than spaces.
|
|
57
|
+
|
|
58
|
+
More information:
|
|
59
|
+
|
|
60
|
+
- <https://agiletribe.wordpress.com/2011/10/27/18-dont-use-tab-characters/>
|
|
61
|
+
- <https://www.jwz.org/doc/tabs-vs-spaces.html>
|
|
62
|
+
- <https://adamspiers.org/computing/why_no_tabs.html>
|
package/doc/md029.md
CHANGED
|
@@ -9,6 +9,8 @@ Parameters:
|
|
|
9
9
|
- `style`: List style (`string`, default `one_or_ordered`, values `one` /
|
|
10
10
|
`one_or_ordered` / `ordered` / `zero`)
|
|
11
11
|
|
|
12
|
+
Fixable: Some violations can be fixed by tooling
|
|
13
|
+
|
|
12
14
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
13
15
|
do not have a prefix that increases in numerical order (depending on the
|
|
14
16
|
configured style). The less-common pattern of using '0.' as a first prefix or
|
package/doc/md033.md
CHANGED
|
@@ -7,6 +7,8 @@ Aliases: `no-inline-html`
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
9
|
- `allowed_elements`: Allowed elements (`string[]`, default `[]`)
|
|
10
|
+
- `table_allowed_elements`: Allowed elements in tables (`string[]`, default
|
|
11
|
+
`[]`)
|
|
10
12
|
|
|
11
13
|
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
12
14
|
|
|
@@ -20,7 +22,11 @@ To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
|
20
22
|
# Markdown heading
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
To allow specific HTML elements anywhere in Markdown content, set the
|
|
26
|
+
`allowed_elements` parameter to a list of HTML element names. To allow a
|
|
27
|
+
specific set of HTML elements within Markdown tables, set the
|
|
28
|
+
`table_allowed_elements` parameter to a list of HTML element names. This can be
|
|
29
|
+
used to permit the use of `<br>`-style line breaks only within Markdown tables.
|
|
24
30
|
|
|
25
31
|
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
26
32
|
those who want their documents to only include "pure" Markdown, or for those
|
package/doc/md055.md
CHANGED
|
@@ -52,4 +52,4 @@ Rationale: Some parsers have difficulty with tables that are missing their
|
|
|
52
52
|
leading or trailing pipe characters. The use of leading/trailing pipes can also
|
|
53
53
|
help provide visual clarity.
|
|
54
54
|
|
|
55
|
-
[gfm-table-055]: https://
|
|
55
|
+
[gfm-table-055]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
package/doc/md056.md
CHANGED
|
@@ -34,4 +34,4 @@ of cells or it will not be recognized as a table (per specification).
|
|
|
34
34
|
Rationale: Extra cells in a row are usually not shown, so their data is lost.
|
|
35
35
|
Missing cells in a row create holes in the table and suggest an omission.
|
|
36
36
|
|
|
37
|
-
[gfm-table-056]: https://
|
|
37
|
+
[gfm-table-056]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|