Syntax
git-cliff uses Tera as the template engine. It has a syntax based on Jinja2 and Django templates.
There are 3 kinds of delimiters and those cannot be changed:
{{and}}for expressions{%or{%-and%}or-%}for statements{#and#}for comments
See the Tera Documentation for more information about control structures, built-ins filters, etc.
Custom built-in filters
git-cliff provides a few custom filters you can use inside templates:
-
upper_first: Converts the first character of a string to uppercase.{{ "hello" | upper_first }} → Hello -
find_regex: Finds all occurrences of a regex pattern in a string.{{ "hello world, hello universe" | find_regex(pat="hello") }} → [hello, hello] -
replace_regex: Replaces all occurrences of a regex pattern with a string.{{ "hello world" | replace_regex(from="o", to="a") }} → hella warld -
split_regex: Splits a string by a regex pattern.{{ "hello world, hello universe" | split_regex(pat=" ") }} → [hello, world,, hello, universe]