Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add markdown link support to native notification panel

Louis Beaumonta5e5b83c6e52
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
index c80fe9561..3bbabe7e8 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
@@ -307,7 +307,7 @@ struct NotificationContentView: View {
}
// MARK: - Basic Markdown text renderer
-// Supports **bold**, `code`, and plain text — no external dependencies
+// Supports **bold**, `code`, [links](url), and plain text
@available(macOS 13.0, *)
struct MarkdownText: View {
@@ -358,6 +358,31 @@ struct MarkdownText: View {
continue
}
}
+ if remaining.hasPrefix("[") {
+ // Link: [text](url)
+ let afterBracket = remaining[remaining.index(after: remaining.startIndex)...]
+ if let closeBracket = afterBracket.firstIndex(of: "]") {
+ let linkText = afterBracket[afterBracket.startIndex..<closeBracket]
+ let afterClose = afterBracket[afterBracket.index(after: closeBracket)...]
+ if afterClose.hasPrefix("(") {
+ let urlStart = afterClose.index(after: afterClose.startIndex)
+ let urlPart = afterClose[urlStart...]
+ if let closeParen = urlPart.firstIndex(of: ")") {
+ let urlStr = String(urlPart[urlPart.startIndex..<closeParen])
+ if let url = URL(string: urlStr) {
+ var linkAttr = AttributedString(String(linkText))
+ linkAttr.link = url
+ linkAttr.underlineStyle = .single
+ result = result + Text(linkAttr)
+ .font(Brand.swiftUIMonoFont(size: 11))
+ .foregroundColor(.primary.opacity(0.7))
+ remaining = urlPart[urlPart.index(after: closeParen)...]
+ continue
+ }
+ }
+ }
+ }
+ }
// Plain character
result = result + Text(String(remaining[remaining.startIndex]))
.font(Brand.swiftUIMonoFont(size: 11))