--- type: plug repo: https://github.com/silverbulletmd/silverbullet author: Silver Bullet Authors --- The directive plug is a built-in plug implementing various so-called โ€œdirectiveโ€ that all take the form of `` and close with ``. Currently the following directives are supported: * `#query` to perform queries: [[๐Ÿ”Œ Directive/Query]] * `#include` to inline the content of another page verbatim: [[@include]] * `#use` to use the content of another as a [handlebars](https://handlebarsjs.com/) template: [[@use]] * `#eval` to evaluate an arbitrary JavaScript expression and inline the result: [[@eval]] ## Include $include The `#include` directive can be used to embed another page into your existing one. The syntax is as follows: Whenever the directives are updated, the body of the directive will be replaced with the latest version of the reference page. ## Use $use The `#use` directive can be used to use a referenced page as a handbars template. Optionally, a JSON object can be passed as argument to the template: which renders as follows: * [[Example plug]] by **** ([repo](https://google.com)) Note that a string is also a valid JSON value: * [ ] #test This is a test task * [ ] [[๐Ÿ”Œ Directive@1340]] This is a test task #test which renders as: * [ ] [[๐Ÿ”Œ Directive@1492]] This is a test task #test ## Eval $eval The `#eval` directive can be used to evaluate arbitrary JavaScript expressions. Itโ€™s also possible to invoke arbitrary plug functions this way. A simple example is multiplying numbers: 100 However, you can also invoke arbitrary plug functions, e.g. the `titleUnfurlOptions` function in the `core` plug: |id |name | |------------|-------------| |title-unfurl|Extract title| Optionally, you can use a `render` clause to render the result as a template, similar to [[๐Ÿ”Œ Directive/Query]]: id: title-unfurl name: Extract title ---