This might work for very simple metadata, like:
title: Foo bar
date: 2020-01-01 10:00:00
This is text
If the metadata delimiters are not found and the option is enabled, the plugin could do something like this:
meta, sep, content = text.partition("\n\n")
try:
metadata = yaml.load(meta, Loader=...)
except yaml.error.YAMLError:
content = text
metadata = {}
else:
# Prevent false-positives if the text does not begin with a metadata block
if isinstance(metadata, str):
metadata = {}
content = text
self.md.Meta = metadata
return content