Other Commands

TextCarver includes a wide range of built-in commands.

Variable manipulation

You can use $$Clear to erase a variable entirely, or just clear some parts of it:

$$Clear{person}
$$Clear{person.lastName}
$$Clear{person.lastName[2]}

Iteration

For more complex operations, you can use $$ForEach to iterate over each element of a variable:

This

$$people = {Alex | Blair | Chris}
$$ForEach{
|.var person
|.source $$people{}
|.do Hello $$person{}
}

Becomes

Hello Alex
Hello Blair
Hello Chris

File access

Use $$Include to include the contents of another file:

$$Include{content.md}

Use $$FilesInDirectory to list the contents of a directory:

$$FilesInDirectory{staffDirectory}

Use the $$IfFileExists conditional to check for the presence of a file:

$$IfFileExists{optionalContent.md}

Text manipulation

There are some built-in text manipulation commands. If you’re familiar with JavaScript, you’ll feel right at home with these.

This

$$Split{, | a,b,c}

Becomes

a
b
c


This

$$people = {Alex | Blair | Chris}
$$Join{, | $$people{}}

Becomes

Alex,Blair,Chris


This

$$people = {Chris | Blair | Alex}
$$Sort{$$people{}}

Becomes

Alex
Blair
Chris


This

$$people = {Chris | Blair | Alex | Chris}
$$SortUnique{$$people{}}

Becomes

Alex
Blair
Chris


This

$$Replace{sailor | admiral | Hello sailor}

Becomes

Hello admiral


This

$$ReplaceRegex{\d{3} | g | secret | The code is 123}

Becomes

The code is secret

Next: ATX Headers