Arbitrary Yaml Block Usage #845
m-paul
started this conversation in
Show and tell
Replies: 2 comments 3 replies
-
I will expose |
Beta Was this translation helpful? Give feedback.
1 reply
-
Noob here. So is this |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have worked out how to introduce my own YAML blocks, outside of the front-matter header.
There is one way I could make it better but could use some help.
Rationale
Obsidian doesn't include backlinks stored in a file's frontmatter when showing outgoing links or the graph. One work-around to this is to store links as inline fields that dataview supports, but dataview doesn't support objects. There are some hacks I have used where I describe objects as tasks, but if Dataview ever were to implement YAML block support, I'd have to rewrite how my pages work (besides, I like using YAML).
One draw back to this approach is that the YAML block looks like a comment block instead of a code block. I'd use code blocks, but Obsidian hides links from the graph in code blocks the same way it does for frontmatter blocks.
Preview
Source
Help
The dataview plugin has a function named parseFrontmatter that can spice up the yaml values. For example, it can replace "[[Jane Doe]]" with a link object. Ideally, I'd like to make use of that function, but I can't for the life of me figure out how to import that function and use it in the dataviewjs block.
So, for example, if you were to print out the content of the yaml via the console, you'd see this:
Where, ideally, I'd like to pass the object through
parseFrontmatter
so that I have an object shaped like this:Beta Was this translation helpful? Give feedback.
All reactions