[Bug] Using the properties menu deletes YAML comments from the frontmatter

Steps to reproduce

  1. In source mode, add a property and a YAML comment to the frontmatter, like such:
---
tags:
# comment
---
  1. Exit source mode and go back into source mode. Nothing will have changed.
  2. Exit source mode and change the property by adding a value, such as a tag.
  3. Switch back into source mode

Expected result

Like in previous Obsidian versions, the comment should still be in the frontmatter

Actual result

The YAML comment has disappeared from the frontmatter

Environment

SYSTEM INFO:
	Obsidian version: v1.4.14
	Installer version: v1.4.13
	Operating system: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 22.6.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: Minimal v7.2.1
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 34
	Plugins enabled: 25
		1: Dictionary v2.22.0
		2: Quick Switcher++ v3.3.7
		3: LanguageTool Integration v0.3.4
		4: Linter v1.20.0
		5: Style Settings v1.0.7
		6: Contextual Typography v2.2.5
		7: Reminder v1.1.15
		8: Omnisearch v1.17.1
		9: Zotero Integration v3.0.10
		10: Calendar v1.5.10
		11: Tolino notes Importer v1.0.3
		12: List Callouts v1.1.4
		13: Emoji Shortcodes v2.2.0
		14: Recent Files v1.3.8
		15: Copy Block Link v1.0.4
		16: Advanced Tables v0.19.1
		17: Outliner v4.8.0
		18: Natural Language Dates v0.6.1
		19: Pandoc Plugin v0.4.1
		20: Minimal Theme Settings v7.3.0
		21: Templater v1.16.3
		22: Tag Wrangler v0.6.1
		23: Dataview v0.5.61
		24: Tasks v4.9.0
		25: QuickAdd v1.4.0

Additional information

This is a very recent bug. A few minor versions/weeks ago, I am very confident this wasn’t a problem yet.

The reason this bug is significant is that I need to add comments to the frontmatter to tell the Zotero integration plugin to “persist” my custom metadata. Thereby, it breaks the workflow of a number of academics like myself. More broadly, this bug may break the functionality of a number of plugins that rely on YAML comments to add additional information to the frontmatter.

I would be very grateful for a fix :smiling_face:

2 Likes

It’s not that recent.

Moved to help.

ok thanks! Didn’t find the the thread below. Even if it’s not recent, I am confident it happened a bit after the introduction of Properties. While I understand the desire to expose a clean API, it would be great if comments are preserved because that would otherwise mean breakage for a number of template engines when they interact with the frontmatter.