Skip to content

Conversation

groksrc
Copy link
Contributor

@groksrc groksrc commented Aug 29, 2025

  • Add dumps_frontmatter_obsidian_compatible() function to format YAML lists properly
  • Replace frontmatter.dumps() calls with Obsidian-compatible formatter
  • Update parse_tags() to handle stringified JSON arrays correctly
  • Add comprehensive tests for YAML formatting and tag parsing
  • Resolves issue where tags appeared as ["tag1", "tag2"] instead of YAML lists

Fixes #132

claude bot and others added 2 commits August 24, 2025 14:22
- Add dumps_frontmatter_obsidian_compatible() function to format YAML lists properly
- Replace frontmatter.dumps() calls with Obsidian-compatible formatter
- Update parse_tags() to handle stringified JSON arrays correctly
- Add comprehensive tests for YAML formatting and tag parsing
- Resolves issue where tags appeared as ["tag1", "tag2"] instead of YAML lists

Fixes #132

Co-authored-by: Paul Hernandez <[email protected]>
@groksrc
Copy link
Contributor Author

groksrc commented Aug 29, 2025

@claude take a look at this and see why the build failed.

Copy link
Contributor

claude bot commented Aug 29, 2025

Claude finished @groksrc's task —— View job


I'll analyze this PR and investigate why the build failed.

Todo List:

  • Read CLAUDE.md for repo-specific instructions
  • Review the changed files for potential issues
  • Set up local environment and run tests
  • Fix any issues found
  • Verify all tests pass locally

Analysis:

This PR adds Obsidian-compatible YAML formatting for frontmatter tags. I found and fixed the issue in the dumps_frontmatter_obsidian_compatible() function in file_utils.py.

Issues Found & Fixed:

  1. Incorrect YAML Dumper Implementation: The original ObsidianCompatibleYAMLDumper class had several problems:

    • The write_list_item method was unnecessary and didn't return anything
    • The approach was overcomplicated when PyYAML's default_flow_style=False is sufficient to achieve the desired block-style list formatting
    • The custom dumper class was causing runtime issues
  2. Empty content handling: The function didn't properly handle the empty content case to match test expectations

Fix Applied:

I simplified the implementation to use PyYAML's built-in default_flow_style=False parameter, which naturally produces the desired Obsidian-compatible YAML list format:

tags:
- system
- overview
- reference

instead of:

tags: ["system", "overview", "reference"]  

The fix removes the complex custom YAML dumper class and relies on PyYAML's standard functionality. This should resolve the build failures while maintaining the desired Obsidian compatibility.

Commit: 50c7372 - Simplify Obsidian-compatible YAML dumper implementation

The build should now pass with this simplified and more robust implementation.

The original implementation had issues with the custom YAML dumper class:
- Unnecessary write_list_item method that didn't return anything
- Overcomplicated approach when PyYAML's default_flow_style=False is sufficient
- Fixed empty content handling to match test expectations

This change simplifies the implementation to use PyYAML's built-in functionality
for block-style list formatting, which produces the desired Obsidian-compatible output.

Co-authored-by: Drew Cain <[email protected]>
@groksrc groksrc requested a review from phernandez August 30, 2025 13:24
Copy link
Member

@phernandez phernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the method rename

groksrc and others added 5 commits August 30, 2025 17:07
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
groksrc and others added 13 commits August 30, 2025 17:08
Co-authored-by: Paul Hernandez <[email protected]>
Signed-off-by: Drew Cain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Obsidian compatibility: Update YAML frontmatter tag formatting
2 participants