Sommerregen / grav-plugin-mediaembed

This plugin embeds several media sites (e.g. YouTube, Vimeo, Soundcloud) by only providing the URL to the medium.
Other
24 stars 8 forks source link

Run mediaembed after Twig #23

Open ItsShadowCone opened 7 years ago

ItsShadowCone commented 7 years ago

I have a simple loop in Twig inside my page that iterates over an array and outputs code for mediaembed like the following

{% for video in videos %}
    ![]({{video}})
{% endfor %}

The problem is, that in the first hook, onPageContentRaw, mediaembed is called with the raw twig code (before twig) whereas in the second hook (onPageContentProcessed) it is called where the twig code is already substituted (after markdown). I would like to have mediaembed called between twig and markdown.

From what i found, wouldn't it be better if mediaembed is called within onMarkdownInitialized instead of or additinally to the other two hooks? see this example: https://github.com/getgrav/grav/pull/747#issuecomment-206821370`