From d1f2dfca05256d79b1ca660cc5e40e01140a3e1a Mon Sep 17 00:00:00 2001 From: perf3ct Date: Sat, 13 Sep 2025 19:42:32 +0000 Subject: [PATCH] fix(docs): handle quoted and unquoted paths in mkdocs fixer --- scripts/fix-html-links.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/fix-html-links.ts b/scripts/fix-html-links.ts index 3eaddbdb7..68f325b44 100644 --- a/scripts/fix-html-links.ts +++ b/scripts/fix-html-links.ts @@ -11,8 +11,16 @@ import * as path from 'path'; */ function fixHtmlLinks(content: string): string { // Replace .md extensions in href attributes - // This regex matches href="...something.md" or href="...something.md#anchor" - return content.replace(/href="([^"]*?)\.md(#[^"]*)?"/g, 'href="$1$2"'); + // Handle both quoted and unquoted href attributes + + // First, handle quoted hrefs: href="...something.md" or href="...something.md#anchor" + content = content.replace(/href="([^"]*?)\.md(#[^"]*)?"/g, 'href="$1$2"'); + + // Then, handle unquoted hrefs: href=...something.md or href=...something.md#anchor + // This matches href= followed by a non-whitespace URL ending in .md + content = content.replace(/href=([^\s>]*?)\.md(#[^\s>]*)?(?=[\s>])/g, 'href=$1$2'); + + return content; } /**