diff --git a/src/djlint/formatter/indent.py b/src/djlint/formatter/indent.py
index 0588892..de813d8 100644
--- a/src/djlint/formatter/indent.py
+++ b/src/djlint/formatter/indent.py
@@ -101,6 +101,17 @@ def indent_html(rawcode: str, config: Config) -> str:
)
and is_block_raw is False
and not is_safe_closing_tag(config, item)
+ # and not ending in a slt like .
+ and not re.findall(
+ rf"(<({slt_html})>)(.*?)((\2)>[^<]*?$)",
+ item,
+ re.IGNORECASE | re.VERBOSE | re.MULTILINE,
+ )
+ and not re.findall(
+ rf"(<({slt_html})\\b.+?>)(.*?)((\2)>[^<]*?$)",
+ item,
+ re.IGNORECASE | re.VERBOSE | re.MULTILINE,
+ )
):
# block to catch inline block followed by a non-break tag
if (
diff --git a/tests/test_html/test_tag_span.py b/tests/test_html/test_tag_span.py
index 21433fc..fd98117 100644
--- a/tests/test_html/test_tag_span.py
+++ b/tests/test_html/test_tag_span.py
@@ -5,7 +5,7 @@ run:
pytest tests/test_html/test_tag_span.py --cov=src/djlint --cov-branch \
--cov-report xml:coverage.xml --cov-report term-missing
- pytest tests/test_html/test_tag_span.py::test_span_tag
+ pytest tests/test_html/test_tag_span.py::test_nested_string
"""
@@ -45,3 +45,23 @@ def test_span_tag(runner: CliRunner, tmp_file: TextIO) -> None:
""",
) # noqa: E501
assert output.exit_code == 0
+
+
+def test_nested_string(runner: CliRunner, tmp_file: TextIO) -> None:
+ write_to_file(
+ tmp_file.name,
+ b""" asdf
+
+ asdf
+
+
+