mirror of
https://github.com/bitsofchris/openaugi-obsidian-plugin.git
synced 2026-07-22 12:40:27 +00:00
strip tags from context saved
This commit is contained in:
parent
f4c842253a
commit
513b007a6a
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue