Skip to content

Commit

Permalink
Update code for new markdownlint library version.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Oct 29, 2024
1 parent 1fff3f2 commit e08f9cd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions markdownlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,13 @@ function lintAndPrint(stdin, files) {
...lintOptions,
resultVersion: 3
};
const markdownlintRuleHelpers = require('markdownlint/helpers');
for (const file of files) {
fixOptions.files = [file];
const fixResult = markdownlint.sync(fixOptions);
const fixes = fixResult[file].filter(error => error.fixInfo);
if (fixes.length > 0) {
const originalText = fs.readFileSync(file, fsOptions);
const fixedText = markdownlintRuleHelpers.applyFixes(originalText, fixes);
const fixedText = markdownlint.applyFixes(originalText, fixes);
if (originalText !== fixedText) {
fs.writeFileSync(file, fixedText, fsOptions);
}
Expand Down

0 comments on commit e08f9cd

Please sign in to comment.