minor #4798 [Doc] Reword whitespace control note about first-newline removal (Amoifr)

This PR was merged into the 3.x branch.

Discussion
----------

[Doc] Reword whitespace control note about first-newline removal

Fixes #4720.

The wording on line 1224 of `doc/templates.rst` ("removal of the first newline **inherited from PHP**") was misleading — Twig does not inherit anything from PHP, it deliberately implements the same behavior (just like Jinja does, which uses *"like in PHP"* in its own documentation).

The note already exists a few lines above (line 1210: *"The first newline after a template tag is removed automatically (like in PHP)."*), so the second mention can just point back to it instead of duplicating the (incorrect) attribution.

Commits
-------

6904b23fb6 [Doc] Reword whitespace control note about first-newline removal
This commit is contained in:
Fabien Potencier
2026-05-14 18:41:00 +01:00
+1 -1
View File
@@ -1221,7 +1221,7 @@ Twig supports two modifiers:
* *Line whitespace trimming* via the ``~`` modifier: Removes all whitespace
(excluding newlines). Using this modifier on the right disables the default
removal of the first newline inherited from PHP.
removal of the first newline mentioned above.
The modifiers can be used on either side of the tags like in ``{%-`` or ``-%}``
and they consume all whitespace for that side of the tag. It is possible to use