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": [

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


But the docs says:
jinja = {
“methods”: [
see: Hooks


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.

1 Like

Thanks.I am using v13. jenv works perfectly.

I know this is a bit of a necro, but thanks so much- you are a godsend. I had been tearing my hair out for a majority of the day on Friday because I was only finding the v14 documentation and some old documenation that gave the hook as jenv = ["method:path"], I hadn’t thought of amalgamating the two. Then I stumbled upon your answer first thing this morning, and it worked. Thanks so much!