About YAML inline blocks

Hello Obsidian fans!
I’ve just found out -expanding my information about YAML on Wikipedia- that this piece of code doesn’t give me an error, can you try it too? I noticed that the “metadata” box does not appear. Greetings to all of you.

Remember the three hyphens at the beginning and end of the YAML metadata.

Code:

---
tags: 
  - name: John Smith
  - age: 33
  - {name: John Smith, age: 33}
---

Update: with a valid tag -for example “Mediterráneo” (the mediterranean sea)-, the “metadata” box is correctly displayed.

All other information does not cause an error in the given YAML.

Code:

---
# Your comments here!
tags: 
  - Mediterráneo
  - [name: John Smith]
  - [age: 33]
  - {name: John Smith, age: 33}
---

Why should it give an error? tags in your example is a perfectly valid YAML sequence consisting of 3 maps. You can verify with the Online YAML Parser.

I think the metadata isn’t shown in preview because a tag’s type must be str, not map, as yours are.

Try something like

tags: tag_1, tag-2, tag3

or

tags:
  - tag_1
  - tag-2
  - tag3

EDIT: @angellom You were faster :rofl:

1 Like

All is good! :slight_smile:

1 Like