From 95a0c00b1aac41a9c5856c7fffbfc9f97cd983ff Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Wed, 24 Jun 2026 13:52:47 +1000 Subject: [PATCH 01/20] feat(notes): recognize Pikchr diagram fences Signed-off-by: Matt Toohey --- .../src/lib/features/notes/NoteModal.svelte | 12 +- .../lib/features/notes/diagramFormats.test.ts | 101 +++++++++++++++++ .../src/lib/features/notes/diagramFormats.ts | 106 ++++++++++++++++++ .../lib/features/notes/noteMarkdown.test.ts | 28 ++++- .../src/lib/features/notes/noteMarkdown.ts | 35 ++++++ 5 files changed, 271 insertions(+), 11 deletions(-) create mode 100644 apps/staged/src/lib/features/notes/diagramFormats.test.ts create mode 100644 apps/staged/src/lib/features/notes/diagramFormats.ts diff --git a/apps/staged/src/lib/features/notes/NoteModal.svelte b/apps/staged/src/lib/features/notes/NoteModal.svelte index 0dd7c955..c5d0e885 100644 --- a/apps/staged/src/lib/features/notes/NoteModal.svelte +++ b/apps/staged/src/lib/features/notes/NoteModal.svelte @@ -11,19 +11,15 @@ import Check from '@lucide/svelte/icons/check'; import MessageCircle from '@lucide/svelte/icons/message-circle'; import FileText from '@lucide/svelte/icons/file-text'; - import { marked } from 'marked'; import * as Dialog from '$lib/components/ui/dialog'; import { Button } from '$lib/components/ui/button'; - import { sanitize } from '../../shared/sanitize'; import { countAssistantMessagesAfter, handleExternalLinkClick } from '../../api/commands'; import { formatChatButtonLabel } from '../sessions/noteFreshness'; import InContentSearch from '../../shared/InContentSearch.svelte'; import { highlightMatches, clearHighlights, scrollToMatch } from '../../shared/textHighlight'; import { registerSearchShortcutTarget } from '../keyboard/searchTargets'; import { viewport } from '../../shared/viewport.svelte'; - import { noteMarkdownWithTitle } from './noteMarkdown'; - - marked.setOptions({ breaks: true, gfm: true }); + import { noteMarkdownWithTitle, renderNoteMarkdown } from './noteMarkdown'; interface Props { open: boolean; @@ -113,10 +109,6 @@ }; }); - function renderMarkdown(text: string): string { - return sanitize(marked.parse(text) as string); - } - async function handleShare() { try { await navigator.clipboard.writeText(noteMarkdown); @@ -276,7 +268,7 @@