From 513b007a6ad18a2c5b99520fa37698036153cb9e Mon Sep 17 00:00:00 2001 From: Chris Lettieri Date: Wed, 14 Jan 2026 17:30:26 -0500 Subject: [PATCH] strip tags from context saved --- src/services/distill-service.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/services/distill-service.ts b/src/services/distill-service.ts index 91d33db..78ccdf0 100644 --- a/src/services/distill-service.ts +++ b/src/services/distill-service.ts @@ -182,6 +182,18 @@ ${content} return content.replace(/```dataview[\s\S]*?```\n?/g, ''); } + /** + * Strip tags from content (e.g., #tag, #nested/tag) + * @param content The content to clean + * @returns Content with tags removed + */ + private stripTags(content: string): string { + // Match tags: # followed by word characters, may include forward slashes for nested tags + // Must be preceded by whitespace or start of line, and followed by whitespace, punctuation, or end of line + // Avoid matching markdown headers (## Header) by requiring non-# after the tag start + return content.replace(/(?:^|(?<=\s))#(?!#)[a-zA-Z0-9_][a-zA-Z0-9_/]*(?=\s|$|[.,;:!?)\]])/gm, ''); + } + /** * Extract dataview queries from content * @param content The content to extract queries from