When python-markdown processes a file the markdown or md object holds the markdown rendering context for other markdown plugins to use. One of these fields is Meta, which stores the metadata information parsed from the header.
This pelican plugin is working correctly in parsing the yaml metadata and passing it to pelican, but it doesn't populate the Meta field of the markdown object, which causes markdown plugins to receive an empty dict as metadata for all articles.
This can be easily simulated by adding self._md.Meta = output to _parse_yaml_metadata, although for compatibility purposes some strings should be wrapped in lists to match python-markdown's expected metadata format.
Or at least populate a few commonly-used metadata fields, like
metadata = self._load_yaml_metadata(m.group("metadata"), source_path)
self._md.Meta = {
'title': [metadata.get('title')],
'date': [metadata.get('date')]
}
return (
self._md.reset().convert(m.group("content")),
metadata,
)
When python-markdown processes a file the
markdownormdobject holds the markdown rendering context for other markdown plugins to use. One of these fields isMeta, which stores the metadata information parsed from the header.This pelican plugin is working correctly in parsing the yaml metadata and passing it to pelican, but it doesn't populate the
Metafield of the markdown object, which causes markdown plugins to receive an empty dict as metadata for all articles.This can be easily simulated by adding
self._md.Meta = outputto_parse_yaml_metadata, although for compatibility purposes some strings should be wrapped in lists to match python-markdown's expected metadata format.Or at least populate a few commonly-used metadata fields, like