From 0a9697dda1f7593a799f0315279719c128dd073e Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Fri, 13 Mar 2026 21:24:01 +0530 Subject: [PATCH] render linked notes properly in pdf and docx --- apps/x/apps/main/src/ipc.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/x/apps/main/src/ipc.ts b/apps/x/apps/main/src/ipc.ts index 77ebd414..d570fcf8 100644 --- a/apps/x/apps/main/src/ipc.ts +++ b/apps/x/apps/main/src/ipc.ts @@ -47,7 +47,14 @@ import { classifySchedule } from '@x/core/dist/knowledge/inline_tasks.js'; function markdownToHtml(markdown: string, title: string): string { // Simple markdown to HTML conversion for export purposes let html = markdown - // Escape HTML entities first (but preserve markdown syntax) + // Resolve wiki links [[Folder/Note Name]] or [[Folder/Note Name|Display]] to plain text + .replace(/\[\[([^\]|]+)\|([^\]]+)\]\]/g, (_match, _path, display) => display.trim()) + .replace(/\[\[([^\]]+)\]\]/g, (_match, linkPath: string) => { + // Use the last segment (filename) as the display name + const segments = linkPath.trim().split('/') + return segments[segments.length - 1] + }) + // Escape HTML entities (but preserve markdown syntax) .replace(/&/g, '&') .replace(//g, '>')