Skip to content

Nunjucks templates don't work across lines in the custom labels #357

@brandoningli

Description

@brandoningli

Issue

When a nunjucks template spans multiple lines in the custom labels, nothing renders.

Example

Broken:

{% if state == "playing" %}
{{media_title}}
{{app_name}}
{% else %}
{{state|capitalize}}
{% endif %}

Image

Works:

{% if state == "playing" %}{{media_title}}{{- '\n' -}}{{app_name}}{% else %}{{state|capitalize}}{% endif %}

Image

Current Behavior

The custom label does not render; the HA icon does

Expected Behavior

The template renders as typed even if it spans multiple lines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions