Skip to content

Commit e39a0da

Browse files
committed
docs: Add example of how to not include frontmatter of template in output
refs: #1368
1 parent 3023f89 commit e39a0da

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/src/commands/execution-command.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ This means that, to output something from a JS execution command, you just need
2222

2323
For example, the following command: `<%* tR += "test" %>` will output `test`.
2424

25+
You can also overwrite `tR` to ignore everything our templating engine has generated up to that point. This can be useful if you want to have frontmatter or other information in your template that you don't want to be inserted when your template is applied.
26+
27+
For example, the following template:
28+
29+
```
30+
---
31+
type: template
32+
---
33+
This is a person template.
34+
35+
<%* tR = "" -%>
36+
---
37+
type: person
38+
---
39+
# <% tp.file.cursor() %>
40+
```
41+
42+
will output:
43+
44+
```
45+
---
46+
type: person
47+
---
48+
#
49+
```
50+
2551
### Suggesters and Prompts
2652

2753
It is important to note that the `tp.system.prompt()` and `tp.system.suggester()` both require a `await` statement to save the value to a variable

0 commit comments

Comments
 (0)