eyeseast / python-frontmatter

Parse and manage posts with YAML (or other) frontmatter
http://python-frontmatter.rtfd.io
MIT License
329 stars 43 forks source link

Is nesting/indentation allowed? #85

Closed pruppert closed 2 years ago

pruppert commented 3 years ago

My python code is:

post['dog'] = "pug"
frontmatter.dump(post, fileName, sort_keys=False)

and this dumps correctly for yaml formatted as following:

animals:
dog: pug

but the following formats both dump dog: null

animals:
  dog:
animals:
- dog:

Is there any way to format my yaml frontmatter so this plugin will dump to indented/nested items?

eyeseast commented 3 years ago

What does it look like if you dump the YAML directly, like this?

import yaml

yaml.dump("""
animals:
  dog:
""")
eyeseast commented 2 years ago

Looking at this again, this looks like it's actually parsing correctly as YAML, where dog is really null. I'm going to close this.