@knowcode/doc-builder 1.10.4 → 1.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core-builder.js +8 -3
- package/package.json +1 -1
package/lib/core-builder.js
CHANGED
|
@@ -349,16 +349,21 @@ function processMarkdownContent(content, config = {}) {
|
|
|
349
349
|
|
|
350
350
|
// Parse the markdown
|
|
351
351
|
let html = marked.parse(processedContent);
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
// Replace placeholders with actual mermaid blocks
|
|
354
354
|
mermaidBlocks.forEach((block, index) => {
|
|
355
355
|
html = html.replace(`<p>MERMAID_BLOCK_${index}</p>`, block);
|
|
356
356
|
html = html.replace(`MERMAID_BLOCK_${index}`, block);
|
|
357
357
|
});
|
|
358
|
-
|
|
358
|
+
|
|
359
|
+
// Convert internal .md links to .html links
|
|
360
|
+
// Matches href="...md" or href='...md' and converts to .html
|
|
361
|
+
// Handles: file.md, path/file.md, file.md#anchor, file.md?query
|
|
362
|
+
html = html.replace(/href=(["'])([^"']*?)\.md((?:#[^"']*)?(?:\?[^"']*)?)\1/gi, 'href=$1$2.html$3$1');
|
|
363
|
+
|
|
359
364
|
// Replace emojis with Phosphor icons if enabled
|
|
360
365
|
html = replaceEmojisWithIcons(html, config);
|
|
361
|
-
|
|
366
|
+
|
|
362
367
|
return html;
|
|
363
368
|
}
|
|
364
369
|
|