Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing a note deletes commented out metadata in the frontmatter #72

Closed
TangentFoxy opened this issue Jan 29, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@TangentFoxy
Copy link
Contributor

I really hate that it reformats the frontmatter, because that breaks my workflow, but I am willing to live with that (especially since Obsidian itself breaks the frontmatter all the time). Deleting commented out data, however, I think is unacceptable.

@TangentFoxy TangentFoxy added the bug Something isn't working label Jan 29, 2024
@alangrainger
Copy link
Owner

I use Obsidian's official native command for updating the frontmatter:

https://docs.obsidian.md/Reference/TypeScript+API/FileManager/processFrontMatter

Any issue you have with that is with them, not with me sorry 🤷

@TangentFoxy
Copy link
Contributor Author

I have raised this issue with the developers, they stick with their previous assertion that deletion of user data is intended behavior. There is an also an open issue on js-yaml, the library ultimately responsible for this issue.

I figure this context is useful for anyone stumbling across this in the future.

@alangrainger
Copy link
Owner

For my own opinion on the matter, you can see I commented in that thread last year:

https://forum.obsidian.md/t/api-processfrontmatter-removes-string-quotes-comments-types-formatting/65851/11

Seems logical to do it the way I suggest there, but no response from Obsidian devs.

@TangentFoxy
Copy link
Contributor Author

I must admit I skimmed that thread and didn't see that, thank you for giving me additional context.

(I also tried raising awareness on the subreddit, and all conversation was shut down. For such a small issue, I'm surprised there's this much drama over it. And while writing this, I just noticed one of my comments on the API thread was deleted, which makes me question what else has been censored. I've been archiving every public-facing page related to this since things started being deleted. To be fair, it was slightly imflammatory, but that was kind of my point - igoring an issue doesn't solve it. Archive before the deletion for reference.)

@alangrainger
Copy link
Owner

alangrainger commented Oct 18, 2024

If it helps you feel more peace about the issue, my approach is to think of YAML as programmatic access only, not as free-form plain text.

My notes are my own formatting, and YAML is there for data exchange between Obsidian and plugins, so I don't care how Obsidian decides to format it - as long as the data remains the same. (In this case, comments are not data, unless you put them into a comment field.)

I did look at refactoring Share Note to modify the YAML without using Obsidian's intended frontmatter method, but it seemed more risky to do it that way, and the cons outweighed the pros.

@TangentFoxy
Copy link
Contributor Author

I thought I was taking that approach! But yea, the big lesson I'm taking from this is to be more flexible about how I put things together, cause even though it's unintentional, the foundations will be pulled from under me.

For what it's worth, I agree, rolling your own implementation is fraught with risk because YAML is difficult to write parsing for and difficult to write correctly as a user because of its edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants