Skip to content

Getting Started

If you have uv installed, you can run MARGARITA without a permanent install:

uvx margarita render greeting.mg

To install it as a persistent tool:

uv tool install margarita


Walkthrough

Create a template file greeting.mg:

<<
Hello, ${name}!
>>

Provide context

Add JSON either inline or in a file greeting.json:

{"name": "Batman"}

Render

Render the template with the CLI:

margarita render greeting.mg -f greeting.json

Rendered result

Using the template and context above the output will be:

Hello, Batman!


Alternate options

  • Pass context as a JSON string: -c '{"name": "Bob"}'
  • Render a directory of .mg files: margarita render templates/ -o output/
  • Inspect template metadata before rendering: margarita render template.mg --show-metadata

Tip: When rendering a single file, MARGARITA will auto-detect a same-name .json file (e.g. greeting.json) if no context is supplied.