Skip to content

Commit

Permalink
docs: dev.include docs
Browse files Browse the repository at this point in the history
fix #17
  • Loading branch information
stdword committed Feb 12, 2024
1 parent 7a031d8 commit c5647ec
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion docs/reference__tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Make a reference to page (`[[name]]`) or block (`((uuid))`).
- block context
- dayjs object
- date ISO string (YYYY-MM-DD)
- `label`: custom label for the reference (optional)
- `label`: (optional) custom label for the reference

<!-- panels:start -->
<!-- div:left-panel -->
Expand Down Expand Up @@ -231,3 +231,37 @@ TODO
### `.context.block` :id=dev-context-block
TODO



### `.include` :id=dev-include
Include another template by name.

`async dev.include(name, ...args?)`
- `name`: template name. Only templates with `template::` property can be included.
- `args`: (optional) arguments for included template. If not specified `template-usage::` property will be used to get arguments values.

<!-- tabs:start -->
#### ***Template***
This is ` ``await dev.include('nested')`` `!

#### ***Template «nested»***
` ``c.template.name`` `

#### ***Rendered***
This is nested!
<!-- tabs:end -->


<!-- tabs:start -->
#### ***Template***
Buy list:
` ``{_ for (const item of ['apple', 'orange', 'lemon']) { _}`` ` \
    ` ``await dev.include('bold', item)`` ` \
` ``{- } }`` `

#### ***Template «bold»***
` ``c.args.$1.bold()`` `

#### ***Rendered***
Buy list: **apple** **orange** **lemon**
<!-- tabs:end -->

0 comments on commit c5647ec

Please sign in to comment.