mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Implement markdownlint-disable-line inline comment (behaves like markdownlint-disable-next-line, but for the current line) (fixes #524).
This commit is contained in:
parent
5f5f44e8e0
commit
3792613d2d
8 changed files with 686 additions and 13 deletions
|
|
@ -410,9 +410,12 @@ function getEnabledRulesPerLineNumber(
|
|||
enabledRulesPerLineNumber.push(enabledRules);
|
||||
}
|
||||
// eslint-disable-next-line jsdoc/require-jsdoc
|
||||
function disableNextLine(action, parameter, lineNumber) {
|
||||
if (action === "DISABLE-NEXT-LINE") {
|
||||
const nextLineNumber = frontMatterLines.length + lineNumber + 1;
|
||||
function disableLineNextLine(action, parameter, lineNumber) {
|
||||
const disableLine = (action === "DISABLE-LINE");
|
||||
const disableNextLine = (action === "DISABLE-NEXT-LINE");
|
||||
if (disableLine || disableNextLine) {
|
||||
const nextLineNumber =
|
||||
frontMatterLines.length + lineNumber + (disableNextLine ? 1 : 0);
|
||||
enabledRulesPerLineNumber[nextLineNumber] =
|
||||
applyEnableDisable(
|
||||
action,
|
||||
|
|
@ -433,7 +436,7 @@ function getEnabledRulesPerLineNumber(
|
|||
capturedRules = enabledRules;
|
||||
handleInlineConfig(lines, enableDisableFile);
|
||||
handleInlineConfig(lines, captureRestoreEnableDisable, updateLineState);
|
||||
handleInlineConfig(lines, disableNextLine);
|
||||
handleInlineConfig(lines, disableLineNextLine);
|
||||
// Return results
|
||||
return {
|
||||
effectiveConfig,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue