Custom Jinja method in HTML print format

Jinja customization via hook is possible.

Custom print format is also fairly common with HTML.

But when i want to use custom jinja methods or filter in HTML print format i get following error:
jinja2.exceptions.UndefinedError: ‘jinja_xyx_method’ is undefined.

Please help me how to use custom jinja method in HTML print format.
Thanks in advance.

jenv = {
        "methods": [
                "function_name:path-to-your-python-function",
        ]
}

Then in HTML, you can use {{ function_name() }}

1 Like

But the docs says:
jinja = {
“methods”: [
“path-to-your-python-file”,
]
}
see: Hooks

1 Like

The structure changed slightly with v14, and jinja is indeed the right hook. If it’s not working for you, even after restarting your environment, it’s likely a path issue.

Thanks.I am using v13. jenv works perfectly.