mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-25 00:16:29 +02:00
render linked notes properly in pdf and docx
This commit is contained in:
parent
26bf21d4da
commit
0a9697dda1
1 changed files with 8 additions and 1 deletions
|
|
@ -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, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue