The inspector supplies complete macro/import source, an explicit autoescape configuration and the arguments for two calls. Switch from A&B to a literal tag-like label to compare expected visible text with escaped serialization. A missing-value scenario holds the expected output instead of inventing zero. The browser shows expected output, not a Jinja render.

Give the fragment a small, explicit contract
The source follows Jinja’s documented 3.1.x macro and import behavior. To use it in a Python project, check your installed version and run the copied templates in that environment.
The macro accepts two arguments: label and value. Its structural contract is one description-list term followed by one description-list value. The caller supplies the surrounding description list.
Source for template macros.html:
{% macro summary(label, value) -%}
<dt>{{ label }}</dt>
<dd>{{ value }}</dd>
{%- endmacro %}
Source for index.html:
{% import "macros.html" as ui %}
<dl>
{{ ui.summary(first_label, first_value) }}
{{ ui.summary(second_label, second_value) }}
</dl>
Copy these snippets into macros.html and index.html in your Python project. The browser page displays their source and expected output; it does not execute Jinja. The first call receives ordinary strings “A&B” and “Ready.” The second receives the ordinary string “Count” and the integer 0.
Jinja supports reusable macros imported through a namespace. A normal import does not receive the current caller context by default, although environment globals are available. We pass all four values explicitly and use no hidden globals. Jinja macros and import behavior
Changing the caller's unrelated label variable should not replace first_label. The macro's named arguments are the mapping to inspect. Avoid adding with context merely to make an accidental dependency work.
Record autoescaping in the environment
A template's HTML extension is not, by itself, a complete configuration record. The environment decides how templates are loaded and whether their output is automatically escaped.
In Python, configure Environment with DictLoader containing macros.html and index.html. Configure select_autoescape explicitly with HTML enabled, default_for_string=True, and default=False. Confirm that both loaded .html templates receive autoescaping. Jinja's API documents extension-based selection and string-template handling; record the actual settings rather than assuming a default. Jinja environment and autoescape API
Keep the inputs as ordinary strings and integers. Do not pre-encode “A&B” into “A&B” before giving it to the macro. That changes the source text and can cause an additional ampersand encoding.
The example's expected serialized term contains A&B, while its visible text is “A&B.” Expected serialization and browser-visible text are different checkpoints. Neither is an actual render result until the native environment is tested.
Preserve the count, including zero
The second row should display “Count” and “0.” Zero is a supplied value, not a missing argument.
Check that the required keys are present before rendering. Missing count removes second_value from the displayed inputs and holds the expected preview for clarification. It does not substitute zero.
The displayed Python setup also calls for checking unexpected null values before rendering. The page provides a missing-key scenario, not a separate null-input control.
Avoid a fallback based on the truthiness of the count. Check that the required integer was supplied, including when its value is zero. After rendering with Jinja, check that the second description-list value still contains 0.
Check text that looks like a tag
In a separate source revision, replace the first label with the ordinary string <em>Note</em>. Leave its value “Ready” and the second row unchanged.
With the recorded autoescaping configuration, the expected visible label is the literal text <em>Note</em>, rather than an emphasized Note element. The expected source represents the angle brackets as entities. No |safe filter or trusted Markup input belongs in this example.
The macro's authored dt/dd structure is intentional template markup. Its arguments are ordinary text. Keep those roles separate instead of escaping the entire rendered fragment again or trusting a label because it passes through a macro. Jinja HTML escaping
This escaping example covers ordinary text in the description-list terms and values. Other output contexts need their own handling.
Inspect the argument mapping
Choose V1 to inspect A&B / Ready and Count / 0. V2 changes only the first ordinary-string label to <em>Note</em>, shown literally in the expected text area. Missing count clears that expected view and asks for the absent required value. Reset returns to V1. When you run the copied templates, compare their output with both views: the literal visible label and its escaped serialization. The browser’s expected preview alone cannot verify that Python render.
Copy this prompt
Create a source and expected-output inspector for a Jinja macro example. Return one self-contained HTML file with revision buttons, displayed input values, a description-list preview, escaped serialization, template source and Python environment setup. Label the browser results as expectations, not executed Python output.
Show macros.html defining summary(label, value) as one dt/dd pair. Show index.html importing macros.html as ui and calling ui.summary(first_label, first_value) and ui.summary(second_label, second_value) inside one dl. Pass arguments explicitly through a normal import.
V1 contains ordinary string first_label "A&B", first_value "Ready", second_label "Count" and integer second_value 0. The expected visible text is A&B with Ready and Count with 0. Its serialized term uses A&B once. V2 changes only first_label to the ordinary string "<em>Note</em>". Show those angle brackets literally in the visible preview and escape them in serialization. Use text assignment for labels rather than inserting them as markup.
Provide V1, V2, Missing count and Reset buttons. Missing count removes second_value, hides and clears the old expected text, and explains that the required input needs clarification. Keep supplied zero valid. Reset restores V1.
Include copyable Python setup using Environment, DictLoader for both templates, StrictUndefined and select_autoescape with HTML enabled, default_for_string=True and default=False. Explain that required keys and types need checking before the later render. Do not pre-encode the inputs or apply safe to labels. Keep this example's escaping explanation specific to ordinary text inside dt/dd.
Use spacious source blocks, readable type and a responsive layout that keeps the arguments near their expected result.
Compare the browser expectation with Jinja
Switch between V1 and V2, checking that Count remains 0 while the first label changes. Then copy the templates and environment setup into your Python project and render both inputs. NOS can render the HTML inspector for discussing the argument mapping. Compare Jinja's serialized text with the expected entities before reusing the macro with another pair of labels.