From 2e9e86aca43dad314b935fb0e0c310192768cc0b Mon Sep 17 00:00:00 2001 From: Fabio Capucci Date: Mon, 30 Dec 2024 14:56:08 +0100 Subject: [PATCH] document custom tags & filters --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 42ef541..ce2b5fe 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,27 @@ $environment = \Keepsuit\Liquid\EnvironmentFactory::new() $environment->addExtension(new CustomExtension()); ``` +## Custom tags and filters + +By default, only the standard liquid tags and filters are available. +But this package provides some custom tags and filters that you can use. + +### Tags + +- `DynamicRender`: This tag replace the default `Render` tag and allows to render dynamic templates (eg. read template name from a variable). + +### Filters + +- `TernaryFilter` + - `ternary`: adds a ternary operator. + ```liquid + {{ condition | ternary: true_value, false_value }} + + # Example + {{ true | ternary: 'yes', 'no' }} # yes + {{ false | ternary: 'yes', 'no' }} # no + ``` + ## Testing ```bash