Basics
Strings & Escaping
Handle special characters in Tiramisu with quoting, backslash escaping, and multi-quote strings.
Tiramisu provides several ways to handle special characters in your content. Understanding quoting and escaping is essential for writing content that contains commas, equals signs, brackets, or quotes.
Quoting with Double Quotes
Wrap text in double quotes to prevent special characters from being parsed:
func { "text with, commas and = signs" } Inside quotes, commas don't split parameters and equals signs don't create named parameters.
Escaping Quotes
The simplest way to include a double quote inside a string is with a backslash:
func { "text with \\"quotes\\" inside" } Alternatively, use multiple quote characters to wrap the string. The outer pair uses more quotes than any sequence inside:
func { ""text with "quotes" inside"" } For text that contains double-double quotes, use triple quotes:
func { """text with ""double quotes"" """ } Backslash Escaping
For individual special characters inside function parameters, use backslash escaping:
| Escape | Result | Purpose |
|---|---|---|
\, | , | Prevents parameter separation |
\= | = | Prevents named parameter parsing |
\{ | { | Prevents function call parsing |
\} | } | Prevents closing a function call |
\[ | [ | Prevents array parsing |
\] | ] | Prevents closing an array |
| backslash + quote | a double quote | Escapes a quote inside a quoted string |
\name | name { ... } | Prevents function call — treats name as literal text |
When to Use What
\,, \=). Use quotes for longer text with multiple special characters. Use multiple quotes when your text itself contains quotes.Examples:
// Single comma - backslash is easiest
func { hello\, world }
// Multiple special chars - quotes are cleaner
func { "text with, commas and = signs" }
// Text with quotes - use double-double quotes
func { ""She said "hello""" } Common Patterns
Math formulas with equals signs:
math { "E = mc^2" } Code snippets with special characters:
codeblock { language = javascript, "const obj = { key: 'value' };" } URLs with query parameters:
link { url = "https://example.com/search?q=hello&lang=en", Search }