mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: Update YAML frontmatter tag formatting for Obsidian compatibility (#280)
Signed-off-by: Drew Cain <groksrc@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com> Co-authored-by: Paul Hernandez <60959+phernandez@users.noreply.github.com>
This commit is contained in:
@@ -219,8 +219,21 @@ def parse_tags(tags: Union[List[str], str, None]) -> List[str]:
|
||||
# First strip whitespace, then strip leading '#' characters to prevent accumulation
|
||||
return [tag.strip().lstrip("#") for tag in tags if tag and tag.strip()]
|
||||
|
||||
# Process comma-separated string of tags
|
||||
# Process string input
|
||||
if isinstance(tags, str):
|
||||
# Check if it's a JSON array string (common issue from AI assistants)
|
||||
import json
|
||||
if tags.strip().startswith('[') and tags.strip().endswith(']'):
|
||||
try:
|
||||
# Try to parse as JSON array
|
||||
parsed_json = json.loads(tags)
|
||||
if isinstance(parsed_json, list):
|
||||
# Recursively parse the JSON array as a list
|
||||
return parse_tags(parsed_json)
|
||||
except json.JSONDecodeError:
|
||||
# Not valid JSON, fall through to comma-separated parsing
|
||||
pass
|
||||
|
||||
# Split by comma, strip whitespace, then strip leading '#' characters
|
||||
return [tag.strip().lstrip("#") for tag in tags.split(",") if tag and tag.strip()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user