From 6a1a76be29e0c69bf2851fb37ee5afbde5d1220f Mon Sep 17 00:00:00 2001 From: ZL Asica <40444637+ZL-Asica@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:32:01 -0600 Subject: [PATCH] fix(docs): fix fix-markdown logic --- fix-markdown.mjs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/fix-markdown.mjs b/fix-markdown.mjs index 234cfaf..fac60ad 100644 --- a/fix-markdown.mjs +++ b/fix-markdown.mjs @@ -26,27 +26,31 @@ function fixMarkdown(filePath) { const newContent = lines.slice(6); const newLines = []; - let skipCurrentLine = false; + let skipProcessing = false; for (let line of newContent) { + if (skipProcessing) { + newLines.push(line); + continue; + } + if (line.startsWith('## Index') || line.startsWith('### Functions')) { - skipCurrentLine = true; + continue; } else if (line.startsWith('## Modules')) { line = line.replace('## Modules', '# Documentation'); - skipCurrentLine = false; } else if (line.startsWith('# Function:')) { line = line.replace('# Function:', '#'); - skipCurrentLine = false; - } else { - skipCurrentLine = false; - } - - if (!skipCurrentLine) { - line = line - .replaceAll(/README.md/g, '') - .replaceAll(/<([A-Za-z]+)>/g, '<$1>'); + } else if (line.startsWith('## Example')) { + skipProcessing = true; newLines.push(line); + continue; } + + line = line + .replaceAll(/README.md/g, '') + .replaceAll(/<([A-Za-z]+)>/g, '<$1>'); + + newLines.push(line); } const fixedContent = newLines.join('\n');