mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add new MD054/link-image-style rule (in-progress PR, no generated files).
This commit is contained in:
parent
20b8af5054
commit
460836445c
14 changed files with 296 additions and 11 deletions
20
test/link-style-autolink-only.md
Normal file
20
test/link-style-autolink-only.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Autolink Link Style
|
||||
|
||||
Text [url](https://example.com) text {MD054}
|
||||
Text  text {MD054}
|
||||
Text [url] text {MD054}
|
||||
Text ![url] text {MD054}
|
||||
Text [text][url] text {MD054}
|
||||
Text ![text][url] text {MD054}
|
||||
Text <https://example.com> text
|
||||
Text [url][] text {MD054}
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-bare-urls": false,
|
||||
"link-image-reference-definitions": false,
|
||||
"link-image-style": {
|
||||
"style": "autolink_only"
|
||||
}
|
||||
} -->
|
||||
20
test/link-style-inline-only.md
Normal file
20
test/link-style-inline-only.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Inline Link Style
|
||||
|
||||
Text [url](https://example.com) text
|
||||
Text  text
|
||||
Text [url] {MD054} text
|
||||
Text ![url] {MD054} text
|
||||
Text [text][url] {MD054} text
|
||||
Text ![text][url] {MD054} text
|
||||
Text <https://example.com> {MD054} text
|
||||
Text [url][] text {MD054}
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-bare-urls": false,
|
||||
"link-image-reference-definitions": false,
|
||||
"link-image-style": {
|
||||
"style": "inline_only"
|
||||
}
|
||||
} -->
|
||||
20
test/link-style-inline-or-autolink.md
Normal file
20
test/link-style-inline-or-autolink.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Inline Link Style
|
||||
|
||||
Text [url](https://example.com) text
|
||||
Text  text
|
||||
Text [url] {MD054} text
|
||||
Text ![url] {MD054} text
|
||||
Text [text][url] {MD054} text
|
||||
Text ![text][url] {MD054} text
|
||||
Text <https://example.com> text
|
||||
Text [url][] text {MD054}
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-bare-urls": false,
|
||||
"link-image-reference-definitions": false,
|
||||
"link-image-style": {
|
||||
"style": "inline_or_autolink"
|
||||
}
|
||||
} -->
|
||||
20
test/link-style-inline-or-reference.md
Normal file
20
test/link-style-inline-or-reference.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Inline Link Style
|
||||
|
||||
Text [url](https://example.com) text
|
||||
Text  text
|
||||
Text [url] text
|
||||
Text ![url] text
|
||||
Text [text][url] text
|
||||
Text ![text][url] text
|
||||
Text <https://example.com> {MD054} text
|
||||
Text [url][] text
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-bare-urls": false,
|
||||
"link-image-reference-definitions": false,
|
||||
"link-image-style": {
|
||||
"style": "inline_or_reference"
|
||||
}
|
||||
} -->
|
||||
18
test/link-style-reference-only.md
Normal file
18
test/link-style-reference-only.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Reference Link Style
|
||||
|
||||
Text [url {MD054}](https://example.com) text
|
||||
Text  text
|
||||
Text [url] text
|
||||
Text ![url] text
|
||||
Text [text][url] text
|
||||
Text ![text][url] text
|
||||
Text <https://example.com> {MD054} text
|
||||
Text [url][] text
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"link-image-style": {
|
||||
"style": "reference_only"
|
||||
}
|
||||
} -->
|
||||
20
test/link-style-reference-or-autolink.md
Normal file
20
test/link-style-reference-or-autolink.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Inline Link Style
|
||||
|
||||
Text [url](https://example.com) text {MD054}
|
||||
Text  text {MD054}
|
||||
Text [url] text
|
||||
Text ![url] text
|
||||
Text [text][url] text
|
||||
Text ![text][url] text
|
||||
Text <https://example.com> text
|
||||
Text [url][] text
|
||||
|
||||
[url]: https://example.com
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-bare-urls": false,
|
||||
"link-image-reference-definitions": false,
|
||||
"link-image-style": {
|
||||
"style": "reference_or_autolink"
|
||||
}
|
||||
} -->
|
||||
|
|
@ -82,7 +82,7 @@ test("projectFiles", (t) => {
|
|||
"schema/*.md"
|
||||
]))
|
||||
.then((files) => {
|
||||
t.is(files.length, 58);
|
||||
t.is(files.length, 59);
|
||||
const options = {
|
||||
files,
|
||||
"config": require("../.markdownlint.json")
|
||||
|
|
@ -839,7 +839,7 @@ test("customFileSystemAsync", (t) => new Promise((resolve) => {
|
|||
}));
|
||||
|
||||
test("readme", async(t) => {
|
||||
t.plan(124);
|
||||
t.plan(126);
|
||||
const tagToRules = {};
|
||||
for (const rule of rules) {
|
||||
for (const tag of rule.tags) {
|
||||
|
|
@ -914,7 +914,7 @@ test("readme", async(t) => {
|
|||
});
|
||||
|
||||
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||
t.plan(162);
|
||||
t.plan(168);
|
||||
const { addSchema, validate } =
|
||||
// eslint-disable-next-line n/file-extension-in-import
|
||||
await import("@hyperjump/json-schema/draft-07");
|
||||
|
|
@ -1046,7 +1046,7 @@ test("validateConfigExampleJson", async(t) => {
|
|||
});
|
||||
|
||||
test("allBuiltInRulesHaveValidUrl", (t) => {
|
||||
t.plan(147);
|
||||
t.plan(150);
|
||||
for (const rule of rules) {
|
||||
// @ts-ignore
|
||||
t.truthy(rule.information);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue