Extend Kida with custom functionality.
Custom Filters
Transform values with `| filter`
Add domain-specific value transformations.
Custom Tests
Create `is test` predicates
Build boolean tests for conditionals.
Custom Globals
Add global functions and variables
Make utilities available everywhere.
Custom Loaders
Load from databases, APIs, etc.
Build custom template sources.
Quick Reference
from kida import Environment
env = Environment()
# Custom filter
@env.filter()
def double(value):
return value * 2
# Custom test
@env.test()
def is_even(value):
return value % 2 == 0
# Custom global
env.add_global("site_name", "My Site")
# Use in templates
# {{ count | double }}
# {% if count is even %}
# {{ site_name }}