Closed Taitava closed 2 years ago
This is absolutely FANTASTIC @Taitava !!!!!!!!!!! π π π π π π π π π π π π π π π π π
And one more detail: E.g. {{yaml_value:tags.-1}}
reads the last item from the tags
list. And {{yaml_value:tags.length}}
gives the number of items in the list. But these two only work for ordered lists, not key-value pair lists:
---
ordered_list_has_a_length_property: # and can use .-1 .-2 etc. indexes
- first-tag
- second-tag
key_value_pair_list_does_not_have_a_length_property:
key1: value1
key2: value2
---
100% understood @Taitava !!!!!!!!!
I've forgotten to mention this is done.
Released.
Discussed in https://github.com/Taitava/obsidian-shellcommands/discussions/56
Gives a single value from the current file's YAML frontmatter.
:property_name
refers to a single property whose value will be retrieved..
notation:The value of the first chapter can be retrieved with
{{yaml_value:book_details.chapters.first}}
.First tag:
{{yaml_value:tags.0}}
Second tag:{{yaml_value:tags.1}}
So lists are 0-indexed! (Note that for Obsidian tags, you cannot access inline tags with this variable - only tags that are defined in the YAML frontmatter.)