From 7290d44db8a06f42f9eeab0d993e4a8e580f4d9d Mon Sep 17 00:00:00 2001 From: Mathys-Gasnier Date: Thu, 2 Jan 2025 18:25:24 +0100 Subject: [PATCH] Improving error message when CRLF line endings are encountered --- utils/snippetParser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/snippetParser.js b/utils/snippetParser.js index d82ef7d7..e2ea33ad 100644 --- a/utils/snippetParser.js +++ b/utils/snippetParser.js @@ -16,10 +16,12 @@ function raise(issue, snippet = '') { return null; } +const crlfRegex = /\r\n/gm; const propertyRegex = /^\s+([a-zA-Z]+):\s*(.+)/; const headerEndCodeStartRegex = /^\s*---\s*```.*\n/; const codeRegex = /^(.+)```/s function parseSnippet(snippetPath, text) { + if(crlfRegex.exec(text) !== null) return raise('Found CRLF line endings instead of LF line endings', snippetPath); let cursor = 0; const fromCursor = () => text.substring(cursor);

AltStyle によって変換されたページ (->オリジナル) /