markdownlint 0.24.0 → 0.26.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 +15 -3
- package/LICENSE +1 -1
- package/README.md +138 -87
- package/demo/markdownlint-browser.js +2028 -1364
- package/doc/CustomRules.md +15 -4
- package/doc/Rules.md +217 -26
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +541 -188
- package/helpers/package.json +4 -1
- package/lib/cache.js +15 -25
- package/lib/constants.js +7 -0
- package/lib/markdownlint.d.ts +27 -19
- package/lib/markdownlint.js +438 -344
- package/lib/md004.js +4 -4
- package/lib/md005.js +4 -4
- package/lib/md006.js +4 -4
- package/lib/md007.js +8 -6
- package/lib/md009.js +20 -13
- package/lib/md010.js +34 -16
- package/lib/md011.js +4 -4
- package/lib/md013.js +4 -5
- package/lib/md014.js +4 -4
- package/lib/md021.js +3 -1
- package/lib/md026.js +1 -1
- package/lib/md027.js +2 -2
- package/lib/md028.js +2 -2
- package/lib/md029.js +5 -4
- package/lib/md030.js +4 -4
- package/lib/md031.js +2 -2
- package/lib/md032.js +3 -2
- package/lib/md033.js +12 -9
- package/lib/md034.js +2 -2
- package/lib/md035.js +10 -5
- package/lib/md036.js +2 -2
- package/lib/md037.js +5 -3
- package/lib/md038.js +7 -4
- package/lib/md039.js +8 -5
- package/lib/md042.js +17 -10
- package/lib/md043.js +2 -3
- package/lib/md044.js +21 -10
- package/lib/md046.js +14 -13
- package/lib/md048.js +13 -14
- package/lib/md049-md050.js +73 -0
- package/lib/md051.js +84 -0
- package/lib/md052.js +35 -0
- package/lib/md053.js +52 -0
- package/lib/rules.js +8 -6
- package/package.json +37 -32
- package/schema/.markdownlint.jsonc +30 -3
- package/schema/.markdownlint.yaml +26 -1
- package/schema/markdownlint-config-schema.json +159 -683
package/doc/CustomRules.md
CHANGED
|
@@ -41,7 +41,8 @@ A rule is implemented as an `Object` with one optional and four required propert
|
|
|
41
41
|
- `description` is a required `String` value that describes the rule in output messages.
|
|
42
42
|
- `information` is an optional (absolute) `URL` of a link to more information about the rule.
|
|
43
43
|
- `tags` is a required `Array` of `String` values that groups related rules for easier customization.
|
|
44
|
-
- `
|
|
44
|
+
- `asynchronous` is an optional `Boolean` value that indicates whether the rule returns a `Promise` and runs asynchronously.
|
|
45
|
+
- `function` is a required `Function` that implements the rule and is passed two parameters:
|
|
45
46
|
- `params` is an `Object` with properties that describe the content being analyzed:
|
|
46
47
|
- `name` is a `String` that identifies the input file/string.
|
|
47
48
|
- `tokens` is an `Array` of [`markdown-it` `Token` objects](https://markdown-it.github.io/markdown-it/#Token)
|
|
@@ -51,7 +52,7 @@ A rule is implemented as an `Object` with one optional and four required propert
|
|
|
51
52
|
- `config` is an `Object` corresponding to the rule's entry in `options.config` (if present).
|
|
52
53
|
- `onError` is a function that takes a single `Object` parameter with one required and four optional properties:
|
|
53
54
|
- `lineNumber` is a required `Number` specifying the 1-based line number of the error.
|
|
54
|
-
- `
|
|
55
|
+
- `detail` is an optional `String` with information about what caused the error.
|
|
55
56
|
- `context` is an optional `String` with relevant text surrounding the error location.
|
|
56
57
|
- `range` is an optional `Array` with two `Number` values identifying the 1-based column and length of the error.
|
|
57
58
|
- `fixInfo` is an optional `Object` with information about how to fix the error (all properties are optional, but
|
|
@@ -66,15 +67,25 @@ A rule is implemented as an `Object` with one optional and four required propert
|
|
|
66
67
|
The collection of helper functions shared by the built-in rules is available for use by custom rules in the
|
|
67
68
|
[markdownlint-rule-helpers package](https://www.npmjs.com/package/markdownlint-rule-helpers).
|
|
68
69
|
|
|
70
|
+
### Asynchronous Rules
|
|
71
|
+
|
|
72
|
+
If a rule needs to perform asynchronous operations (such as fetching a network resource), it can specify the value `true` for its `asynchronous` property.
|
|
73
|
+
Asynchronous rules should return a `Promise` from their `function` implementation that is resolved when the rule completes.
|
|
74
|
+
(The value passed to `resolve(...)` is ignored.)
|
|
75
|
+
Linting violations from asynchronous rules are reported via the `onError` function just like for synchronous rules.
|
|
76
|
+
|
|
77
|
+
**Note**: Asynchronous rules cannot be referenced in a synchronous calling context (i.e., `markdownlint.sync(...)`).
|
|
78
|
+
Attempting to do so throws an exception.
|
|
79
|
+
|
|
69
80
|
## Examples
|
|
70
81
|
|
|
71
82
|
- [Simple rules used by the project's test cases](../test/rules)
|
|
72
83
|
- [Code for all `markdownlint` built-in rules](../lib)
|
|
73
84
|
- [Package configuration for publishing to npm](../test/rules/npm)
|
|
74
85
|
- Packages should export a single rule object or an `Array` of rule objects
|
|
75
|
-
- [Custom rules from the Microsoft/vscode-docs-authoring repository](https://github.com/microsoft/vscode-docs-authoring/tree/
|
|
86
|
+
- [Custom rules from the Microsoft/vscode-docs-authoring repository](https://github.com/microsoft/vscode-docs-authoring/tree/main/packages/docs-linting/markdownlint-custom-rules)
|
|
76
87
|
- [Custom rules from the axibase/docs-util repository](https://github.com/axibase/docs-util/tree/master/linting-rules)
|
|
77
|
-
- [Custom rules from the webhintio/hint repository](https://github.com/webhintio/hint/blob/
|
|
88
|
+
- [Custom rules from the webhintio/hint repository](https://github.com/webhintio/hint/blob/main/scripts/lint-markdown.js)
|
|
78
89
|
|
|
79
90
|
## References
|
|
80
91
|
|
package/doc/Rules.md
CHANGED
|
@@ -13,7 +13,7 @@ Tags: headings, headers
|
|
|
13
13
|
|
|
14
14
|
Aliases: heading-increment, header-increment
|
|
15
15
|
|
|
16
|
-
This rule is triggered when you skip heading levels in a
|
|
16
|
+
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
17
17
|
example:
|
|
18
18
|
|
|
19
19
|
```markdown
|
|
@@ -292,7 +292,11 @@ Tags: bullet, ul, indentation
|
|
|
292
292
|
|
|
293
293
|
Aliases: ul-indent
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
<!-- markdownlint-disable line-length -->
|
|
296
|
+
|
|
297
|
+
Parameters: indent, start_indented, start_indent (number; default 2, boolean; default false, number; defaults to indent)
|
|
298
|
+
|
|
299
|
+
<!-- markdownlint-restore -->
|
|
296
300
|
|
|
297
301
|
Fixable: Most violations can be fixed by tooling
|
|
298
302
|
|
|
@@ -319,13 +323,15 @@ rule).
|
|
|
319
323
|
|
|
320
324
|
The `start_indented` parameter allows the first level of lists to be indented by
|
|
321
325
|
the configured number of spaces rather than starting at zero (the inverse of
|
|
322
|
-
MD006).
|
|
326
|
+
MD006). The `start_indent` parameter allows the first level of lists to be indented
|
|
327
|
+
by a different number of spaces than the rest (ignored when `start_indented` is not
|
|
328
|
+
set).
|
|
323
329
|
|
|
324
330
|
Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
325
331
|
line with the start of the content of the parent list when a single space is
|
|
326
332
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
327
333
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
328
|
-
issue for
|
|
334
|
+
issue for other Markdown parsers, which require 4-space indents. More information:
|
|
329
335
|
<https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
|
|
330
336
|
and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
|
|
331
337
|
|
|
@@ -390,7 +396,7 @@ Tags: whitespace, hard_tab
|
|
|
390
396
|
|
|
391
397
|
Aliases: no-hard-tabs
|
|
392
398
|
|
|
393
|
-
Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1)
|
|
399
|
+
Parameters: code_blocks, ignore_code_languages, spaces_per_tab (boolean; default true, array of string; default empty, number; default 1)
|
|
394
400
|
|
|
395
401
|
Fixable: Most violations can be fixed by tooling
|
|
396
402
|
|
|
@@ -418,12 +424,20 @@ Some text
|
|
|
418
424
|
* Spaces used to indent the list item instead
|
|
419
425
|
```
|
|
420
426
|
|
|
421
|
-
You have the option to exclude this rule for code blocks. To do so,
|
|
422
|
-
`code_blocks` parameter to `false`. Code blocks are included
|
|
423
|
-
handling of tabs by tools
|
|
427
|
+
You have the option to exclude this rule for code blocks and spans. To do so,
|
|
428
|
+
set the `code_blocks` parameter to `false`. Code blocks and spans are included
|
|
429
|
+
by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
|
|
430
|
+
using 4 vs. 8 spaces).
|
|
431
|
+
|
|
432
|
+
When code blocks are scanned (e.g., by default or if `code_blocks` is `true`),
|
|
433
|
+
the `ignore_code_languages` parameter can be set to a list of languages that
|
|
434
|
+
should be ignored (i.e., hard tabs will be allowed, though not required). This
|
|
435
|
+
makes it easier for documents to include code for languages that require hard
|
|
436
|
+
tabs.
|
|
424
437
|
|
|
425
|
-
|
|
426
|
-
|
|
438
|
+
By default, violations of this rule are fixed by replacing the tab with 1 space
|
|
439
|
+
character. To use a different number of spaces, set the `spaces_per_tab`
|
|
440
|
+
parameter to the desired value.
|
|
427
441
|
|
|
428
442
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
429
443
|
can be harder to work with than spaces.
|
|
@@ -853,7 +867,7 @@ in changelogs):
|
|
|
853
867
|
### Features
|
|
854
868
|
```
|
|
855
869
|
|
|
856
|
-
Rationale: Some
|
|
870
|
+
Rationale: Some Markdown parsers generate anchors for headings based on the
|
|
857
871
|
heading name; headings with the same content can cause problems with that.
|
|
858
872
|
|
|
859
873
|
<a name="md025"></a>
|
|
@@ -1008,7 +1022,7 @@ blockquote symbol at the beginning of the blank line:
|
|
|
1008
1022
|
> This is the same blockquote.
|
|
1009
1023
|
```
|
|
1010
1024
|
|
|
1011
|
-
Rationale: Some
|
|
1025
|
+
Rationale: Some Markdown parsers will treat two blockquotes separated by one
|
|
1012
1026
|
or more blank lines as the same blockquote, while others will treat them as
|
|
1013
1027
|
separate blockquotes.
|
|
1014
1028
|
|
|
@@ -1289,13 +1303,13 @@ Aliases: no-inline-html
|
|
|
1289
1303
|
|
|
1290
1304
|
Parameters: allowed_elements (array of string; default empty)
|
|
1291
1305
|
|
|
1292
|
-
This rule is triggered whenever raw HTML is used in a
|
|
1306
|
+
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
1293
1307
|
|
|
1294
1308
|
```markdown
|
|
1295
1309
|
<h1>Inline HTML heading</h1>
|
|
1296
1310
|
```
|
|
1297
1311
|
|
|
1298
|
-
To fix this, use 'pure'
|
|
1312
|
+
To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
1299
1313
|
|
|
1300
1314
|
```markdown
|
|
1301
1315
|
# Markdown heading
|
|
@@ -1303,9 +1317,9 @@ To fix this, use 'pure' markdown instead of including raw HTML:
|
|
|
1303
1317
|
|
|
1304
1318
|
Note: To allow specific HTML elements, use the 'allowed_elements' parameter.
|
|
1305
1319
|
|
|
1306
|
-
Rationale: Raw HTML is allowed in
|
|
1307
|
-
those who want their documents to only include "pure"
|
|
1308
|
-
who are rendering
|
|
1320
|
+
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
1321
|
+
those who want their documents to only include "pure" Markdown, or for those
|
|
1322
|
+
who are rendering Markdown documents into something other than HTML.
|
|
1309
1323
|
|
|
1310
1324
|
<a name="md034"></a>
|
|
1311
1325
|
|
|
@@ -1331,20 +1345,20 @@ For more information, see <https://www.example.com/>.
|
|
|
1331
1345
|
```
|
|
1332
1346
|
|
|
1333
1347
|
Note: To use a bare URL without it being converted into a link, enclose it in
|
|
1334
|
-
a code block, otherwise in some
|
|
1348
|
+
a code block, otherwise in some Markdown parsers it *will* be converted:
|
|
1335
1349
|
|
|
1336
1350
|
```markdown
|
|
1337
1351
|
`https://www.example.com`
|
|
1338
1352
|
```
|
|
1339
1353
|
|
|
1340
|
-
Note: The following scenario does
|
|
1354
|
+
Note: The following scenario does *not* trigger this rule to avoid conflicts
|
|
1341
1355
|
with `MD011`/`no-reversed-links`:
|
|
1342
1356
|
|
|
1343
1357
|
```markdown
|
|
1344
1358
|
[https://www.example.com]
|
|
1345
1359
|
```
|
|
1346
1360
|
|
|
1347
|
-
The use of quotes around a bare link will
|
|
1361
|
+
The use of quotes around a bare link will *not* trigger this rule, either:
|
|
1348
1362
|
|
|
1349
1363
|
```markdown
|
|
1350
1364
|
"https://www.example.com"
|
|
@@ -1352,7 +1366,7 @@ The use of quotes around a bare link will _not_ trigger this rule, either:
|
|
|
1352
1366
|
```
|
|
1353
1367
|
|
|
1354
1368
|
Rationale: Without angle brackets, the URL isn't converted into a link by many
|
|
1355
|
-
|
|
1369
|
+
Markdown parsers.
|
|
1356
1370
|
|
|
1357
1371
|
<a name="md035"></a>
|
|
1358
1372
|
|
|
@@ -1362,8 +1376,8 @@ Tags: hr
|
|
|
1362
1376
|
|
|
1363
1377
|
Aliases: hr-style
|
|
1364
1378
|
|
|
1365
|
-
Parameters: style ("consistent", "---", "***", or other string specifying
|
|
1366
|
-
horizontal rule; default "consistent")
|
|
1379
|
+
Parameters: style ("consistent", "---", "***", "___", or other string specifying
|
|
1380
|
+
the horizontal rule; default "consistent")
|
|
1367
1381
|
|
|
1368
1382
|
This rule is triggered when inconsistent styles of horizontal rules are used
|
|
1369
1383
|
in the document:
|
|
@@ -1421,7 +1435,7 @@ _Another section_
|
|
|
1421
1435
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
1422
1436
|
```
|
|
1423
1437
|
|
|
1424
|
-
To fix this, use
|
|
1438
|
+
To fix this, use Markdown headings instead of emphasized text to denote
|
|
1425
1439
|
sections:
|
|
1426
1440
|
|
|
1427
1441
|
```markdown
|
|
@@ -1744,7 +1758,7 @@ Tags: spelling
|
|
|
1744
1758
|
|
|
1745
1759
|
Aliases: proper-names
|
|
1746
1760
|
|
|
1747
|
-
Parameters: names, code_blocks (string array; default `null`, boolean; default `true`)
|
|
1761
|
+
Parameters: names, code_blocks, html_elements (string array; default `null`, boolean; default `true`, boolean; default `true`)
|
|
1748
1762
|
|
|
1749
1763
|
Fixable: Most violations can be fixed by tooling
|
|
1750
1764
|
|
|
@@ -1762,7 +1776,10 @@ the proper capitalization, specify the desired letter case in the `names` array:
|
|
|
1762
1776
|
]
|
|
1763
1777
|
```
|
|
1764
1778
|
|
|
1765
|
-
Set the `code_blocks` parameter to `false` to disable this rule for code blocks
|
|
1779
|
+
Set the `code_blocks` parameter to `false` to disable this rule for code blocks
|
|
1780
|
+
and spans. Set the `html_elements` parameter to `false` to disable this rule
|
|
1781
|
+
for HTML elements and attributes (such as when using a proper name as part of
|
|
1782
|
+
a path for `a`/`href` or `img`/`src`).
|
|
1766
1783
|
|
|
1767
1784
|
Rationale: Incorrect capitalization of proper names is usually a mistake.
|
|
1768
1785
|
|
|
@@ -1911,3 +1928,177 @@ The configured list style can be a specific symbol to use (backtick, tilde), or
|
|
|
1911
1928
|
can require that usage be consistent within the document.
|
|
1912
1929
|
|
|
1913
1930
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1931
|
+
|
|
1932
|
+
<a name="md049"></a>
|
|
1933
|
+
|
|
1934
|
+
## MD049 - Emphasis style should be consistent
|
|
1935
|
+
|
|
1936
|
+
Tags: emphasis
|
|
1937
|
+
|
|
1938
|
+
Aliases: emphasis-style
|
|
1939
|
+
|
|
1940
|
+
Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
|
|
1941
|
+
|
|
1942
|
+
Fixable: Most violations can be fixed by tooling
|
|
1943
|
+
|
|
1944
|
+
This rule is triggered when the symbols used in the document for emphasis do not
|
|
1945
|
+
match the configured emphasis style:
|
|
1946
|
+
|
|
1947
|
+
```markdown
|
|
1948
|
+
*Text*
|
|
1949
|
+
_Text_
|
|
1950
|
+
```
|
|
1951
|
+
|
|
1952
|
+
To fix this issue, use the configured emphasis style throughout the document:
|
|
1953
|
+
|
|
1954
|
+
```markdown
|
|
1955
|
+
*Text*
|
|
1956
|
+
*Text*
|
|
1957
|
+
```
|
|
1958
|
+
|
|
1959
|
+
The configured emphasis style can be a specific symbol to use ("asterisk",
|
|
1960
|
+
"underscore"), or can require that usage be consistent within the document.
|
|
1961
|
+
|
|
1962
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1963
|
+
|
|
1964
|
+
<a name="md050"></a>
|
|
1965
|
+
|
|
1966
|
+
## MD050 - Strong style should be consistent
|
|
1967
|
+
|
|
1968
|
+
Tags: emphasis
|
|
1969
|
+
|
|
1970
|
+
Aliases: strong-style
|
|
1971
|
+
|
|
1972
|
+
Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
|
|
1973
|
+
|
|
1974
|
+
Fixable: Most violations can be fixed by tooling
|
|
1975
|
+
|
|
1976
|
+
This rule is triggered when the symbols used in the document for strong do not
|
|
1977
|
+
match the configured strong style:
|
|
1978
|
+
|
|
1979
|
+
```markdown
|
|
1980
|
+
**Text**
|
|
1981
|
+
__Text__
|
|
1982
|
+
```
|
|
1983
|
+
|
|
1984
|
+
To fix this issue, use the configured strong style throughout the document:
|
|
1985
|
+
|
|
1986
|
+
```markdown
|
|
1987
|
+
**Text**
|
|
1988
|
+
**Text**
|
|
1989
|
+
```
|
|
1990
|
+
|
|
1991
|
+
The configured strong style can be a specific symbol to use ("asterisk",
|
|
1992
|
+
"underscore"), or can require that usage be consistent within the document.
|
|
1993
|
+
|
|
1994
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1995
|
+
|
|
1996
|
+
<a name="md051"></a>
|
|
1997
|
+
|
|
1998
|
+
## MD051 - Link fragments should be valid
|
|
1999
|
+
|
|
2000
|
+
Tags: links
|
|
2001
|
+
|
|
2002
|
+
Aliases: link-fragments
|
|
2003
|
+
|
|
2004
|
+
This rule is triggered when a link fragment does not correspond to a heading
|
|
2005
|
+
in the document:
|
|
2006
|
+
|
|
2007
|
+
```markdown
|
|
2008
|
+
# Title
|
|
2009
|
+
|
|
2010
|
+
[Link](#fragment)
|
|
2011
|
+
```
|
|
2012
|
+
|
|
2013
|
+
To fix the issue, change the fragment to reference an existing heading:
|
|
2014
|
+
|
|
2015
|
+
```markdown
|
|
2016
|
+
[Link](#title)
|
|
2017
|
+
```
|
|
2018
|
+
|
|
2019
|
+
Alternatively, an HTML `a` tag with an `id` (or a `name`) attribute defines a
|
|
2020
|
+
valid anchor:
|
|
2021
|
+
|
|
2022
|
+
```markdown
|
|
2023
|
+
<a id="fragment"></a>
|
|
2024
|
+
```
|
|
2025
|
+
|
|
2026
|
+
Some platforms (e.g., [GitHub][github-section-links]) automatically create HTML
|
|
2027
|
+
anchors for every heading. This makes it easy to link to different sections in
|
|
2028
|
+
a document. These internal links can break over time as headings are renamed.
|
|
2029
|
+
|
|
2030
|
+
Note: Creating anchors for headings is not part of the CommonMark specification.
|
|
2031
|
+
|
|
2032
|
+
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
|
|
2033
|
+
|
|
2034
|
+
<a name="md052"></a>
|
|
2035
|
+
|
|
2036
|
+
## MD052 - Reference links and images should use a label that is defined
|
|
2037
|
+
|
|
2038
|
+
Tags: images, links
|
|
2039
|
+
|
|
2040
|
+
Aliases: reference-links-images
|
|
2041
|
+
|
|
2042
|
+
Links and images in Markdown can provide the link destination or image source
|
|
2043
|
+
at the time of use or can define it elsewhere and use a label for reference.
|
|
2044
|
+
The reference format is convenient for keeping paragraph text clutter-free
|
|
2045
|
+
and makes it easy to reuse the same URL in multiple places.
|
|
2046
|
+
|
|
2047
|
+
There are three kinds of reference links and images:
|
|
2048
|
+
|
|
2049
|
+
```markdown
|
|
2050
|
+
Full: [text][label]
|
|
2051
|
+
Collapsed: [label][]
|
|
2052
|
+
Shortcut: [label]
|
|
2053
|
+
|
|
2054
|
+
Full: ![text][image]
|
|
2055
|
+
Collapsed: ![image][]
|
|
2056
|
+
Shortcut: ![image]
|
|
2057
|
+
|
|
2058
|
+
[label]: https://example.com/label
|
|
2059
|
+
[image]: https://example.com/image
|
|
2060
|
+
```
|
|
2061
|
+
|
|
2062
|
+
A link or image renders correctly when a corresponding label is defined, but
|
|
2063
|
+
the text displays with brackets if the label is not present. This rule warns
|
|
2064
|
+
of undefined labels for "full" and "collapsed" reference syntax.
|
|
2065
|
+
|
|
2066
|
+
> "Shortcut" syntax is ambiguous and a missing label will not generate an
|
|
2067
|
+
error. For example, `[shortcut]` could be a shortcut link or the text
|
|
2068
|
+
"shortcut" in brackets.
|
|
2069
|
+
|
|
2070
|
+
<a name="md053"></a>
|
|
2071
|
+
|
|
2072
|
+
## MD053 - Link and image reference definitions should be needed
|
|
2073
|
+
|
|
2074
|
+
Tags: images, links
|
|
2075
|
+
|
|
2076
|
+
Aliases: link-image-reference-definitions
|
|
2077
|
+
|
|
2078
|
+
Fixable: Most violations can be fixed by tooling
|
|
2079
|
+
|
|
2080
|
+
Links and images in Markdown can provide the link destination or image source
|
|
2081
|
+
at the time of use or can define it elsewhere and use a label for reference.
|
|
2082
|
+
The reference format is convenient for keeping paragraph text clutter-free
|
|
2083
|
+
and makes it easy to reuse the same URL in multiple places.
|
|
2084
|
+
|
|
2085
|
+
Because link and image reference definitions are located separately from
|
|
2086
|
+
where they are used, there are two scenarios where a definition can be
|
|
2087
|
+
unnecessary:
|
|
2088
|
+
|
|
2089
|
+
1. If a label is not referenced by any link or image in a document, that
|
|
2090
|
+
definition is unused and can be deleted.
|
|
2091
|
+
1. If a label is defined multiple times in a document, the first definition is
|
|
2092
|
+
used and the others can be deleted.
|
|
2093
|
+
|
|
2094
|
+
This rule considers a reference definition to be used if any link or image
|
|
2095
|
+
reference has the corresponding label. "Full", "collapsed", and "shortcut"
|
|
2096
|
+
formats are all supported.
|
|
2097
|
+
|
|
2098
|
+
<!-- markdownlint-configure-file {
|
|
2099
|
+
"no-inline-html": {
|
|
2100
|
+
"allowed_elements": [
|
|
2101
|
+
"a"
|
|
2102
|
+
]
|
|
2103
|
+
}
|
|
2104
|
+
} -->
|
package/helpers/LICENSE
CHANGED