Skip to content

Conversation

@mxstrand
Copy link
Contributor

Proposed changes

Hatter uses {{ }} for expression evaluation (e.g., {{ faker.lastName() }}). However, some use cases require outputting literal {{ }} in fixture data - for example when fixtures contain template strings that use the same syntax for variable substitution at runtime.

Currently, there is no way to output literal {{ }} in a Hatter fixture. Any {{content}} is interpreted as an expression and evaluated.

This PR adds support for backslash escaping: \{{name}} outputs literal {{name}} without evaluation.

Usage Example

  tables:
    email_templates:
      rows:
        welcome:
          subject: "Welcome \{{username}}"
          body: "Hello \{{name}}, your account is ready."

Backward Compatibility

The backslash escape is new syntax that was previously invalid (would have caused an expression evaluation error), so no existing fixtures are affected.

Checklist

Further comments

@joostfaassen joostfaassen merged commit 674752d into linkorb:main Dec 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants