rosscdh / mkdocs-markdownextradata-plugin

A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
MIT License
83 stars 18 forks source link

event is undefined caused by event() in snippet #52

Closed agardnerIT closed 1 month ago

agardnerIT commented 1 month ago
now-{{ event()['duration']}}

This snippet is causing an exception...

jinja2.exceptions.UndefinedError: 'event' is undefined
agardnerIT commented 1 month ago

For anyone else the issue is the {{ which are being interpreted by jinja.

Fix is to surround the block with {% raw %} and {% endraw %} like this:

{% raw %}

now-{{ event()['duration'] }}

{% endraw %}
rosscdh commented 1 month ago

Well done 👍

On Mon, 19 Aug 2024, 10:10 Adam Gardner, @.***> wrote:

For anyone else the issue is the {{ which are being interpreted by jinja.

Fix is to surround the block with {% raw %} and {% endraw %} like this:

{% raw %}

now-{{ event()['duration'] }}

{% endraw %}

— Reply to this email directly, view it on GitHub https://github.com/rosscdh/mkdocs-markdownextradata-plugin/issues/52#issuecomment-2295448095, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADA6MWZDALYVFRWKUXX7ELZSEZY5AVCNFSM6AAAAABMRT4VR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGQ2DQMBZGU . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>