For years, I’ve used a custom program I wrote to manage my contacts, interacting with a SQlite database with fields for name, surname, phones, emails, and the like. Recently, I decided to migrate to Obsidian, so I exported all the contacts into an Obsidian vault so that the fields are mapped to properties AND written in the body in a user-friendly way. For example, for the property instagram with the value @thisuser, it’s written in the fronmatter and ALSO the body of the note includes the string ig: [@thisuser](https://instagram.com/thisuser).
What I want to do now is get rid of the original custom program and use Obsidian exclusively for this. But I wish to keep this body content in sync with the properties. So, when I create a new contact, I’d like to have a way to populate its properties from the content, stripping hyperlinks as necessary.
As the notes are freeform, this would probably not be automated, but triggered by a shortcut, for example, selecting the ig: line and pressing a hotkey.
How could I go about this?
What I’m trying to do
I’m trying to keep both the frontmatter properties and the rich version in the body, in the simplest way possible.
Things I have tried
I’ve looked at the docs for stuff like Templater, Dataview, and QuickAdd, but they are all pretty complex and I’m wondering if there are better ways to approach this.
If dynamic solutions are acceptable (where the data lives only in properties but a code makes it render in the body too), the feature request that that comment is replying to may be of interest: Show / Display / Embed the note properties within the note body.
A simpler version but probably less useful because it requires a separate Markdown editor is iA Writer’s way of referencing metadata in the body: Metadata – iA.
Thank you, Cawlin! I’ve read those posts and they are very interesting. What I’d like to do is however the opposite of what they achieve – I want my properties to get updated based on the content of the note. For example, if I add an Instagram address to the body, I could have a way to press a hotkey and have the instagram property added or updated.
I ended up installing the Shell Commands plugin and I’m now writing a perl script to process the note text externally. It looks like the easiest solution for me right now. But I’m still open to ideas on how to do it all inside Obsidian!
I do not have a similar use case but I have increasingly found that parsing programatically is difficult as you cannot be prepared for all cases, so I like to put AI in the mix to decide what to do with something, and then you can send the response (parsed or otherwise) to the Obsidian API processFrontMatter.
You can then use the CodeScript Toolkit plugin to manage your (.ts, .js) scripts or even get a .ts script to live inside Obsidian with some listener set up (any AI tool online can help; Claude is now up to ver4.5) to automatically update the frontmatter as you open a note (new leaf), etc. So using free Google Gemini for in-script decision making can be beneficial. I am against creating content with AI but for getting help from AI in these cases, when simple regex matching is well nigh impossible.
Well, in this scenario all cases are decided by me, so manual parsing is always possible. But you have a point, this is one situation where AI can actually be generally helpful.