diff --git a/homeassistant/components/template/helpers.py b/homeassistant/components/template/helpers.py index 1f476181e719..5f66ed86b201 100644 --- a/homeassistant/components/template/helpers.py +++ b/homeassistant/components/template/helpers.py @@ -269,7 +269,9 @@ def create_legacy_template_issue( try: config.pop(CONF_PLATFORM, None) modified_yaml = format_migration_config(config) - yaml_config = yaml_util.dump({DOMAIN: [{domain: [modified_yaml]}]}) + yaml_config = ( + f"```\n{yaml_util.dump({DOMAIN: [{domain: [modified_yaml]}]})}\n```" + ) except RecursionError: yaml_config = f"{DOMAIN}:\n - {domain}: - ..." diff --git a/homeassistant/components/template/strings.json b/homeassistant/components/template/strings.json index 90ff404cb2f3..80a36cae70b0 100644 --- a/homeassistant/components/template/strings.json +++ b/homeassistant/components/template/strings.json @@ -529,7 +529,7 @@ "title": "Deprecated battery level option in {entity_name}" }, "deprecated_legacy_templates": { - "description": "The legacy `platform: template` syntax for `{domain}` is being removed. Please migrate `{breadcrumb}` to the modern template syntax.\n#### Step 1 - Remove legacy configuration\nRemove the `{breadcrumb}` template definition from the `configuration.yaml` `{domain}:` section.\n\n**Note:** If you are using `{domain}: !include {filename}.yaml` in `configuration.yaml`, remove the {domain} definition from the included `{filename}.yaml`.\n#### Step 2 - Add the modern configuration\nAdd new template definition inside `configuration.yaml`:\n\n```{config}```\n\n**Note:** If there are any existing `template:` sections in your configuration, make sure to omit the `template:` line from the yaml above. There can only be 1 `template:` section in `configuration.yaml`. Also, ensure the indentation is aligned with the existing entities within the `template:` section.\n#### Step 3 - Restart Home Assistant or reload template entities", + "description": "The legacy `platform: template` syntax for `{domain}` is being removed. Please migrate `{breadcrumb}` to the modern template syntax.\n#### Step 1 - Remove legacy configuration\nRemove the `{breadcrumb}` template definition from the `configuration.yaml` `{domain}:` section.\n\n**Note:** If you are using `{domain}: !include {filename}.yaml` in `configuration.yaml`, remove the {domain} definition from the included `{filename}.yaml`.\n#### Step 2 - Add the modern configuration\nAdd new template definition inside `configuration.yaml`:\n{config}\n**Note:** If there are any existing `template:` sections in your configuration, make sure to omit the `template:` line from the yaml above. There can only be 1 `template:` section in `configuration.yaml`. Also, ensure the indentation is aligned with the existing entities within the `template:` section.\n#### Step 3 - Restart Home Assistant or reload template entities", "title": "Legacy {domain} template deprecation" } },