devnull, I encountered a similar situation, and I decided to do it.
In the converter, I registered a pre-render hook to pull the YAML into a variable, so in the actual convert method I have access to the information I just pulled. In addition, another post_render hook is post_render to remove this piece of information, as this should be data for each record.
Side note. I found that convert would be called twice, once for use in the html <meta> , once for the actual content. The hook will only be called for the second, not the first. You may need to protect the convert function.
One more note. I think that the YAML in the converter is not unreasonable. As in pandoc , where you can specify a bibliography file in the YAML section and perform other fine-tuning, people should also be given the opportunity to configure a single message using YAML.
def initialize(config) super(config) Jekyll::Hooks.register :posts, :pre_render do |post| if matches(post.data["ext"])
source share