Update MD054/link-image-style to add url_inline parameter (fixes #753).

This commit is contained in:
David Anson 2023-11-12 22:42:02 -08:00
parent 84333a5f08
commit b709a2f624
26 changed files with 347 additions and 39 deletions

View file

@ -2240,6 +2240,7 @@ Parameters:
- `inline`: Allow inline links and images (`boolean`, default `true`)
- `shortcut`: Allow shortcut reference links and images (`boolean`, default
`true`)
- `url_inline`: Allow URLs as inline links (`boolean`, default `true`)
Fixable: Some violations can be fixed by tooling
@ -2305,6 +2306,20 @@ This rule does *not* fix scenarios that require converting a link or image to
the `full`, `collapsed`, or `shortcut` reference styles because that involves
naming the reference and determining where to insert it in the document.
Setting the `url_inline` parameter to `false` prevents the use of inline links
with the same absolute URL text/destination and no title because such links can
be converted to autolinks:
```markdown
[https://example.com](https://example.com)
```
To fix `url_inline` violations, use the simpler autolink syntax instead:
```markdown
<https://example.com>
```
Rationale: Consistent formatting makes it easier to understand a document.
Autolinks are concise, but appear as URLs which can be long and confusing.
Inline links and images can include descriptive text, but take up more space in

View file

@ -13,6 +13,7 @@ Parameters:
- `inline`: Allow inline links and images (`boolean`, default `true`)
- `shortcut`: Allow shortcut reference links and images (`boolean`, default
`true`)
- `url_inline`: Allow URLs as inline links (`boolean`, default `true`)
Fixable: Some violations can be fixed by tooling
@ -78,6 +79,20 @@ This rule does *not* fix scenarios that require converting a link or image to
the `full`, `collapsed`, or `shortcut` reference styles because that involves
naming the reference and determining where to insert it in the document.
Setting the `url_inline` parameter to `false` prevents the use of inline links
with the same absolute URL text/destination and no title because such links can
be converted to autolinks:
```markdown
[https://example.com](https://example.com)
```
To fix `url_inline` violations, use the simpler autolink syntax instead:
```markdown
<https://example.com>
```
Rationale: Consistent formatting makes it easier to understand a document.
Autolinks are concise, but appear as URLs which can be long and confusing.
Inline links and images can include descriptive text, but take up more space in