Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Feb 8, 2025
1 parent a41024f commit ea5c27f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/md038.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { addErrorContext } from "../helpers/helpers.cjs";
import { addErrorContext, newLineRe } from "../helpers/helpers.cjs";
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

Expand Down Expand Up @@ -32,14 +32,15 @@ export default {
const endSpaces = endCount > 0;
// Check if safe to remove 1-space padding
const removePadding = startSpaces && endSpaces && startPadding && endPadding && !startBacktick && !endBacktick;
const context = codeText.text.replace(newLineRe, "\n");
// If extra space at start, report violation
if (startSpaces) {
const startColumn = (removePadding ? startPadding : startData).startColumn;
const length = startCount + (removePadding ? startPadding.text.length : 0);
addErrorContext(
onError,
startData.startLine,
codeText.text,
context,
true,
false,
[ startColumn, length ],
Expand All @@ -56,7 +57,7 @@ export default {
addErrorContext(
onError,
endData.endLine,
codeText.text,
context,
false,
true,
[ endColumn - length, length ],
Expand Down

0 comments on commit ea5c27f

Please sign in to comment.