Directives

Directives are instructions that interact programmatically with an Urtext project. Urtext has three kinds of directives:

  • Targeted: Directs text output to another node, file or virtual target.
  • Action: Performs a specific action on demand
  • Global: Runs globally to extend or modify the behavior or functionality of Urtext, either at the project or the project list level.

Directives have capitalized, non-whitespace names, with underscores permitted.

Targeted

Targeted directives are written inside dynamic definition wrappers, double square brackets:

[[    ]]

Text inside these wrappers is interpreted as instructional code. Targeted directives can be written anywhere; it is not necessary to store a definition in the same file to which it refers.

Targeted directives are followed immediately by opening and closing parentheses which enclose zero or more parameters. A minimal targeted dynamic definition includes a TARGET() directive for the output and another directive to specify the output. The target can be a node, file or virtual target.

[[
TARGET(| Some output Node >)
INCLUDE(*)
]]

The link wrapper syntax inside the TARGET() directive is not required but makes the parameter more readable and also provides a working link to the output node.

There are no restrictions on spacing, indentation, newlines, or other arbitrary text or whitespace. Dynamic definitions may contain any number of directives.Directives are evaluated imperatively, in order from first to last.

Making a dynamic definition does not create the target node. The target node must exist in the project. It may be in the same file or in any other file in the project.

In Sublime Urtext, a snippet is provided to automate creating and titling a new node and populating its dynamic definition in one step. To invoke it, type dynamic and press tab. Type the name of the new node, then tab between entry points in the definition template. Delete whatever portions you do not need.

Action

[ coming soon ]

Global

[ coming soon ]