FileManager.processFrontMatter creates plain text at the top of the note if there are no existing properties

Steps to reproduce

  1. Create empty note (any note without a yaml header will do), make sure it is the active note.
  2. Open developer console.
  3. Run this code:
let thisNote = app.workspace.getActiveFile()
let callback = (f) => {f.test = "hello"}
app.fileManager.processFrontMatter(thisNote, callback)

Did you follow the troubleshooting guide? [Y/N]

Yes, I’ve confirmed this behavior in the sandbox vault.

Expected result

Note content

---
test: hello
---

Actual result

Note content:

test: hello

Environment

SYSTEM INFO:
Obsidian version: v1.5.5
Installer version: v1.4.13
Operating system: Windows 10 Home 10.0.22631
Login status: logged in
Catalyst license: vip
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none

1 Like

please try to search before posting.

I did, but didn’t see the existing one. Perhaps the edit on it fixed a typo? Apologies for the duplication.

Edit: Ah, no, I see. There were a lot of hits for processFrobtMatter, so I narrowed my search to bug reports, and that post is not in that topic.

For the future, there’s also this in the bug report template:

  • Developer issues with the API and custom CSS issues should go here

Thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.