Debugging Utilities¶
This section covers internal helpers and configuration data structures for visual swap debugging.
Debugging Reference (htmx_nav.debugging)¶
Debug-swap marker: Add an inline <script> to flash a target element
when HTMX_NAV_DEBUG_SWAPS is enabled.
_build_marker_script is used both by Swap.render() internally and by
the public debug_swap_marker templatetag.
Debugging Reference (htmx_nav.templatetags.htmx_nav)¶
Template tags for django-htmx-nav.
- htmx_nav.templatetags.htmx_nav.htmx_nav_debug_marker(target_id)[source]¶
Render a debug-swap marker script for hand-crafted out-of-band fragments.
Emits the same inline
<script>tag thatSwapproduces whentarget_idis configured andHTMX_NAV_DEBUG_SWAPSis enabled. Useful when writing manual OOB wrappers (e.g. within{% partialdef %}blocks) that bypassSwapauto-wrapping.- Parameters:
target_id (
str) – Target DOM element ID to highlight.- Return type:
SafeString- Returns:
A safe HTML string containing the inline
<script>tag whenHTMX_NAV_DEBUG_SWAPSis enabled, or an empty string.
Example
{% load htmx_nav %} <div id="breadcrumbs" hx-swap-oob="innerHTML"> {% htmx_nav_debug_marker "breadcrumbs" %} <nav>...</nav> </div>