You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ Enhance your files with variables, conditional blocks and PHP functions as filte
16
16
-[Templates Syntax Highlighting for VS Code](#templates-syntax-highlighting-for-vs-code)
17
17
-[Usage](#usage)
18
18
-[Template syntax](#template-syntax)
19
+
-[Comments](#comments)
19
20
-[Conditions](#conditions)
20
21
-[Variables](#variables)
21
22
-[Default values](#default-values)
@@ -37,6 +38,7 @@ Enhance your files with variables, conditional blocks and PHP functions as filte
37
38
- Use [built-in filters](#built-in-filters) or provide custom functions
38
39
- Use `<% if %>` blocks to conditionally parse the template
39
40
- Use `<% else %>` blocks to provide an alternative content if the condition is not met
41
+
- Include `<# comments #>` in the template files that are removed after patsing
40
42
- Parse template files to string
41
43
- Parse the entire file as a string
42
44
- Provide a custom regex pattern to parse functions to use a custom syntax
@@ -69,6 +71,16 @@ To get syntax highlighting for template files (highlight `<% variable|placeholde
69
71
70
72
### Template syntax
71
73
74
+
#### Comments
75
+
76
+
You can use comments in your templates by using the following syntax:
77
+
78
+
```
79
+
<# This is a comment #>
80
+
```
81
+
82
+
Comments are ignored by the parser and will be removed from the parsed output.
83
+
72
84
#### Conditions
73
85
74
86
You can use conditions in your templates by using the `<% if %>` and `<% endif %>` tags. The condition must be a valid PHP expression that will be evaluated and if it returns `true`, the content between the tags will be included in the final output.
* Converts a YAML, JSON or NEON file to a corresponding PHP object, replacing all template variables with the provided `$arguments` values.
160
173
* @deprecated 3.2.0 __Will be removed in the next version.__ This was used for parsing JSON/YAML/NEON templates in v1 and is no longer needed in v2 and later.
@@ -272,7 +285,7 @@ public static function isValid(string $filename, ?string $contents = null): bool
272
285
thrownewRuntimeException("Failed to get template schema from remote server: " . $e->getMessage());
0 commit comments