Search code examples
pythonjinja2

Is there an official format for documenting macros in Jinja?


I want to document how my Jinja macros work. Is there an official format for documenting macros in Jinja, just like how there are various ways to format Python docstrings?
Maybe something like this:

{% macro my_macro(arg0, arg1, ...) -%}
    {#
    Does something. <- summary of macro

    Parameters:
    arg0: (summary of arg0)
    arg1: (summary of arg1)
    ...
    #}
{%- endmacro %}

Or is it just up to my personal preference?


Solution

  • A Jinja macro is just a Python function. Use the same format you use for documenting normal Python functions.