Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
351 stars 11 forks source link

{{yaml_value:property_name}} variable #120

Closed Taitava closed 2 years ago

Taitava commented 2 years ago

Discussed in https://github.com/Taitava/obsidian-shellcommands/discussions/56

Gives a single value from the current file's YAML frontmatter.

FelipeRearden commented 2 years ago

This is absolutely FANTASTIC @Taitava !!!!!!!!!!! πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€ πŸ‘€

Taitava commented 2 years ago

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
---
FelipeRearden commented 2 years ago

100% understood @Taitava !!!!!!!!!

Taitava commented 2 years ago

I've forgotten to mention this is done.

Taitava commented 2 years ago

Released.