Skip to content

Commit 6dd5aa1

Browse files
committed
Attempt to update markdownlint breaking changes
1 parent ae614e7 commit 6dd5aa1

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"dependencies": {
2727
"@github/markdownlint-github": "^0.8.0",
2828
"js-yaml": "^4.1.0",
29+
"markdown-it": "14.1.0",
2930
"markdownlint": "^0.38.0"
3031
}
3132
}

src/validate.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1+
import markdownIt from "markdown-it";
12
import markdownlint from "markdownlint";
2-
import yaml from 'js-yaml';
3-
import markdownlintGitHub from "@github/markdownlint-github";
3+
import yaml from "js-yaml";
4+
const markdownItFactory = () => markdownIt({ html: true });
45

56
export const validate = (markdown, config) => {
6-
const configObject = yaml.load(config)
7-
return (markdownlint
8-
.sync({
9-
strings: {
10-
content: markdown,
11-
},
12-
config: config ? { default: false, ...configObject } : {
13-
default: false,
14-
"no-default-alt-text": true,
15-
"no-alt-text": true,
16-
"no-empty-alt-text": true,
17-
},
18-
handleRuleFailures: true,
19-
customRules: markdownlintGitHub,
20-
})
21-
.content?.map((error) => {
22-
return `- ${error.ruleDescription} at line ${error.lineNumber}`;
23-
}) ?? []).join("\n");
24-
}
7+
const configObject = yaml.load(config);
8+
return (
9+
markdownlint
10+
.sync({
11+
strings: {
12+
content: markdown,
13+
},
14+
config: config
15+
? { default: false, ...configObject }
16+
: {
17+
default: false,
18+
"no-default-alt-text": true,
19+
"no-alt-text": true,
20+
"no-empty-alt-text": true,
21+
},
22+
handleRuleFailures: true,
23+
markdownItFactory,
24+
customRules: ["@github/markdownlint-github"],
25+
})
26+
.content?.map((error) => {
27+
return `- ${error.ruleDescription} at line ${error.lineNumber}`;
28+
}) ?? []
29+
).join("\n");
30+
};

0 commit comments

Comments
 (0)