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 maxLineNum = lines.length;
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 lineNumStr = String(lineNum);
147
- const padding = lineNumStr.length < lineNumWidth ? " " : "";
145
+ const lineNumIdentifier = `[${lineNum}]`.padStart(setwidthAmount);
148
146
  if (errorLineNumbers.has(lineNum)) {
149
- return `${padding}${RED}[${lineNumStr}]:${RESET} ${line}`;
147
+ return `${RED}${lineNumIdentifier}:${RESET} ${line}`;
150
148
  }
151
- return `${padding}[${lineNumStr}]: ${line}`;
149
+ return `${lineNumIdentifier}: ${line}`;
152
150
  }).join("\n");
153
151
  return formattedLines;
154
152
  }
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3UMY7T6G.js";
10
10
  import {
11
11
  remarkLatexCompile
12
- } from "./chunk-XVMRLEQM.js";
12
+ } from "./chunk-Z6DVEB7O.js";
13
13
  import {
14
14
  astroNormalizePaths
15
15
  } from "./chunk-TLOFSB33.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compileLatexToSvg,
3
3
  remarkLatexCompile
4
- } from "../chunk-XVMRLEQM.js";
4
+ } from "../chunk-Z6DVEB7O.js";
5
5
  import "../chunk-QGM4M3NI.js";
6
6
  export {
7
7
  compileLatexToSvg,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starlight-cannoli-plugins",
3
3
  "type": "module",
4
- "version": "2.5.3",
4
+ "version": "2.5.4",
5
5
  "description": "Starlight plugins for automatic sidebar generation and link validation",
6
6
  "license": "ISC",
7
7
  "main": "./dist/index.js",