starlight-cannoli-plugins 2.5.3 → 2.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -138,17 +138,15 @@ function formatLatexSourceWithLineNumbers(latexSource, errors) {
|
|
|
138
138
|
const RED = "\x1B[31m";
|
|
139
139
|
const RESET = "\x1B[0m";
|
|
140
140
|
const lines = latexSource.split("\n");
|
|
141
|
-
const
|
|
142
|
-
const lineNumWidth = String(maxLineNum).length;
|
|
141
|
+
const setwidthAmount = "[999]".length;
|
|
143
142
|
const errorLineNumbers = new Set(errors.map((e) => e.line).filter(Boolean));
|
|
144
143
|
const formattedLines = lines.map((line, index) => {
|
|
145
144
|
const lineNum = index + 1;
|
|
146
|
-
const
|
|
147
|
-
const padding = lineNumStr.length < lineNumWidth ? " " : "";
|
|
145
|
+
const lineNumIdentifier = `[${lineNum}]`.padStart(setwidthAmount);
|
|
148
146
|
if (errorLineNumbers.has(lineNum)) {
|
|
149
|
-
return `${
|
|
147
|
+
return `${RED}${lineNumIdentifier}:${RESET} ${line}`;
|
|
150
148
|
}
|
|
151
|
-
return `${
|
|
149
|
+
return `${lineNumIdentifier}: ${line}`;
|
|
152
150
|
}).join("\n");
|
|
153
151
|
return formattedLines;
|
|
154
152
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED