mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 23:59:02 +02:00
fix(docs): handle quoted and unquoted paths in mkdocs fixer
This commit is contained in:
parent
fd690592ba
commit
d1f2dfca05
@ -11,8 +11,16 @@ import * as path from 'path';
|
|||||||
*/
|
*/
|
||||||
function fixHtmlLinks(content: string): string {
|
function fixHtmlLinks(content: string): string {
|
||||||
// Replace .md extensions in href attributes
|
// Replace .md extensions in href attributes
|
||||||
// This regex matches href="...something.md" or href="...something.md#anchor"
|
// Handle both quoted and unquoted href attributes
|
||||||
return content.replace(/href="([^"]*?)\.md(#[^"]*)?"/g, 'href="$1$2"');
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user