Spintax Syntax Reference

Complete reference for spintax template markup. The syntax is compatible with the Generating The Web (GTW) standard.

Enumerations { }

Randomly selects one option from the list.

{option1|option2|option3}

Examples

{blue|grey|clear}
{|online|internet} casino        ← empty option = sometimes nothing
{1X{S|s}lots}                    ← nested enumerations
{license {|#8048} from Curacao}  ← nesting with empty option

Rules

Permutations [ ]

Selects N elements, shuffles them, and joins with separators.

Simple permutations

All elements included, space-separated:

[1|2|3|4]

Output examples: 1 4 3 2, 2 3 4 1, 3 2 4 1

With separator

Uniform separator specified in < > at the start:

[<, > 1|2|3|4]

Output examples: 2, 1, 4, 3, 4, 3, 2, 1

Important: No space between [ and <separator>.

Per-element separators

Each option can have its own separator defined with <sep> before the preceding |:

[<, > 1|2|3 < and >|4]

Output examples: 1, 3, 2 and 4, 3, 1, 2 and 4

Permutations with combinations

Configurable min/max element count and separators:

[<minsize=1;maxsize=3;sep=", ";lastsep=" and "> apple|plum|orange|apricot]

Output examples: apple, plum and orange, apple and apricot, orange

Configuration parameters

ParameterDefaultDescription
minsizecount of allMinimum number of elements to pick
maxsizecount of allMaximum number of elements to pick
sep" " (space)Separator between non-final items
lastsepsame as sepSeparator before the last element

Permutation rules

Variables %var%

Defines a reusable variable that is substituted wherever it appears.

#set %VARIABLE_NAME% = value or spintax structure

Examples

#set %name% = John
#set %greeting% = {Hello|Hi|Hey}
#set %items% = [<minsize=2;maxsize=3;sep=", ";lastsep=" and "> apples|oranges|bananas]
Some text with %name% and %greeting%, also %items%.

Variable rules

Variable scopes in the WordPress plugin

The plugin supports three variable scopes. When the same name exists in multiple scopes, the strongest scope wins:

  1. Runtime variables (strongest) — passed via shortcode: [spintax slug="greeting" name="Alice"]
  2. Local variables — defined with #set inside the template
  3. Global variables (weakest) — defined on the Settings page

Includes #include

Embeds another template at the directive's position.

#include "hero-text"

Include rules

Comments /#...#/

Text between comment markers is stripped from the output before any other processing.

/#
  This is a comment section.
  It can span multiple lines.
  It won't appear in output.
#/

Comment rules

Nesting

All syntax elements can be nested within each other to arbitrary depth:

{option1|[<, > sub1|sub2|sub3]|option3}

[<minsize=2;maxsize=3;sep=", ";lastsep=" and "> {red|blue} apples|{big|small} oranges|bananas]

#set %var% = {a|[b|c]}

Post-Processing

The engine applies automatic text correction after generation:

  1. Shield URLs, emails, domains, decimals, and abbreviations from capitalization
  2. Collapse duplicate spaces and tabs
  3. Remove whitespace before punctuation (, . ! ?)
  4. Add space after punctuation where missing
  5. Capitalize first letter of the output (skipping HTML tags)
  6. Capitalize after sentence-ending punctuation
  7. Capitalize after block-level HTML tags
  8. Capitalize after line breaks
  9. Restore shielded placeholders

Syntax Summary

FeatureSyntaxBehavior
Enumeration{a|b|c}Pick one random option
Permutation[a|b|c]Pick N, shuffle, join
Separator[<sep> a|b|c]Permutation with uniform separator
Per-element sep[<,> a|b <x>|c]Permutation with custom separators
Combinations[<config> a|b|c]Permutation with min/max count
Variable#set %var% = valReusable substitution
Include#include "slug"Embed another template
Comment/#...#/Stripped from output

The syntax is compatible with the Generating The Web (GTW) standard.