Updates to MD

This commit is contained in:
Raven Scott
2026-04-25 23:18:44 -04:00
parent 0e3e5be329
commit d9d9f6ddb9
93 changed files with 368 additions and 370 deletions
+8 -10
View File
@@ -13,14 +13,16 @@ const args = new Set(process.argv.slice(2))
const shouldWrite = args.has('--write')
const skipDirs = new Set(['.git', 'node_modules'])
const token = String.raw`[A-Za-z0-9_./:@-]+(?: [A-Za-z0-9_./:@-]+)*`
const strictToken = String.raw`[A-Za-z0-9_./:@-]+`
const fixers = [
// `**token**` -> **`token`**
[/(?<!`)`\*\*((?:(?!\*\*)[^`\n])+)\*\*`/g, '**`$1`**'],
[new RegExp(String.raw`\`\*\*(${token})\*\*\``, 'g'), '**`$1`**'],
// `**token`** -> **`token`**
[/(?<!`)`\*\*((?:(?!`\*\*)[^`\n])+?)`\*\*/g, '**`$1`**'],
[new RegExp(String.raw`\`\*\*(${token})\`\*\*`, 'g'), '**`$1`**'],
// **`token**` -> **`token`**
[/\*\*`((?:(?!\*\*`)[^`\n])+)\*\*`/g, '**`$1`**'],
[new RegExp(String.raw`\*\*\`(${token})\*\*\``, 'g'), '**`$1`**'],
// **`[link](path)`** -> **[link](path)**
[/\*\*`\[([^\]\n]+)\]\(([^)\n]+)\)`\*\*/g, '**[$1]($2)**'],
// `**[link](path)**` -> **[link](path)**
@@ -31,11 +33,7 @@ const fixers = [
[/\*\*`\[([^\]\n]+)\]\(([^)\n]+)\)`\*\*/g, '**[$1]($2)**']
]
const suspiciousPatterns = [
/(?<!`)`\*\*((?:(?!\*\*)[^`\n])+)\*\*`/,
/(?<!`)`\*\*((?:(?!`\*\*)[^`\n])+?)`\*\*/,
/\*\*`((?:(?!\*\*`)[^`\n])+)\*\*`/
]
const suspiciousPatterns = []
async function collectMarkdownFiles(dir) {
const entries = await readdir(dir, { withFileTypes: true })
@@ -85,7 +83,7 @@ for (const filePath of files) {
changed.push(path.relative(repoRoot, filePath))
}
if (hasRenderedDoubleAsterisk && hasSuspiciousPatternRemaining) {
if (hasSuspiciousPatternRemaining || (hasRenderedDoubleAsterisk && hasSuspiciousPatternRemaining)) {
flagged.push(path.relative(repoRoot, filePath))
}
}
@@ -96,7 +94,7 @@ if (changed.length) {
}
if (flagged.length) {
console.log('\nRendered output plus suspicious source pattern still found in:')
console.log('\nSuspicious malformed markdown token pattern still found in:')
for (const file of flagged) console.log(`- ${file}`)
console.log('\nInspect these manually or extend fixers in scripts/fix-markdown-rendered-asterisks.mjs.')
process.exitCode = 1