Explicitly set a specific reader class for markdown files #3428
-
My initial problem is that I want to use both the jinja2content plugin and the yaml-metadata plugin. Since they both register themselves as readers for Markdown files, unfortunately their effect is not combined, but rather only one of them is active at a time (in my case it was the YAML metadata plugin that “won”). My attempt at a solution was creating a simple new reader that subclasses both: from pelican.plugins.jinja2content import JinjaContentMixin
from pelican.plugins.yaml_metadata import YAMLMetadataReader
class JinjaYAMLMarkdownReader(JinjaContentMixin, YAMLMetadataReader):
pass I tried activating that in the settings: READERS = {"md": JinjaYAMLMarkdownReader} Unfortunately, this does not have an effect. What did help, though, is registering a new format, "mdj", and rename my source files accordingly. My interpretation is that the READERS setting does not actually set the readers, but just adds the specified class to the internal list, but another registered reader wins. Is my understanding correct? Is there a way to explicitly set a reader class for a format? Or would there be a smarter way to solve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Frederick — I had the same exact problem...take a look at my solution for ideas on how to address it. |
Beta Was this translation helpful? Give feedback.
Frederick — I had the same exact problem...take a look at my solution for ideas on how to address it.