Skip to content

Commit 9963b7a

Browse files
committed
Document escaping of double braces in templates and update related examples
1 parent 31e4b38 commit 9963b7a

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

docs/api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ run('echo {{ message | quote }}');
264264
run('grep -r {{ pattern | quote }} {{release_path}}');
265265
```
266266

267+
To output literal `{{` without replacement, escape with a backslash `\{{`:
268+
```php
269+
run('echo \{{not_replaced}}'); // outputs: {{not_replaced}}
270+
```
271+
267272

268273

269274
| Argument | Type | Comment |

src/functions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ function within(string $path, callable $callback): mixed
382382
* run('grep -r {{ pattern | quote }} {{release_path}}');
383383
* ```
384384
*
385+
* To output literal `{{` without replacement, escape with a backslash `\{{`:
386+
* ```php
387+
* run('echo \{{not_replaced}}'); // outputs: {{not_replaced}}
388+
* ```
389+
*
385390
* @param string $command Command to run on remote host.
386391
* @param string|null $cwd Sets the process working directory. If not set {{working_path}} will be used.
387392
* @param int|null $timeout Sets the process timeout (max. runtime). The timeout in seconds (default: 300 sec; see {{default_timeout}}, `null` to disable).

0 commit comments

Comments
 (0)