Skip to main content

Built-in Plugins

These plugins are built into microfern. You do have to import and pass them into format explicitly, but they are included in the standard install. Check this example to see how to do that.

List of Plugins

uppercase

This plugin converts all characters in the input text to uppercase.

Template
Chef's secret: {{ fruit | uppercase }} is the key to a good smoothie!
Variables
{
    "fruit": "banana"
}
Output
Chef's secret: BANANA is the key to a good smoothie!
Edit the template or variables to see the output change.

lowercase

This plugin converts all characters in the input text to lowercase.

Template
Whisper it: i love {{ veggie | lowercase }} in my salad!
Variables
{
    "veggie": "BROCCOLI"
}
Output
Whisper it: i love broccoli in my salad!
Edit the template or variables to see the output change.

capitalize

This plugin capitalizes the first character of the input text.

Template
Once upon a thyme, there was an {{ herb | capitalize }}...
Variables
{
    "herb": "italian parsley"
}
Output
Once upon a thyme, there was an Italian parsley...
Edit the template or variables to see the output change.

titleCase

This plugin converts the input text to title case, capitalizing the first letter of each word.

Template
Breaking News: {{ headline | titleCase }}
Variables
{
    "headline": "local man finds tomato that looks like elvis"
}
Output
Breaking News: Local Man Finds Tomato That Looks Like Elvis
Edit the template or variables to see the output change.

snakeCase

This plugin replaces spaces in the input text with underscores.

Template
Secret code: {{ message | snakeCase }}
Variables
{
    "message": "the carrots are listening"
}
Output
Secret code: the_carrots_are_listening
Edit the template or variables to see the output change.

kebabCase

This plugin replaces spaces in the input text with hyphens.

Template
<a href="/meals/{{ dish | kebabCase }}">Today's special</a>
Variables
{
    "dish": "Eggplant Extravaganza"
}
Output
<a href="/meals/Eggplant-Extravaganza">Today's special</a>
Edit the template or variables to see the output change.

camelCase

This plugin converts the input text to camel case, removing spaces and capitalizing the first letter of each word except the first.

Template
Variable name: {{ fruitSalad | camelCase }}IsYummy
Variables
{
    "fruitSalad": "tropical fruit bonanza"
}
Output
Variable name: tropicalFruitBonanzaIsYummy
Edit the template or variables to see the output change.

pascalCase

This plugin converts the input text to pascal case, removing spaces and capitalizing the first letter of each word.

Template
Class name: {{ veggieDish | pascalCase }}Recipe
Variables
{
    "veggieDish": "turnip the beet salad"
}
Output
Class name: TurnipTheBeetSaladRecipe
Edit the template or variables to see the output change.

trim

This plugin removes whitespace from both ends of the input text.

Template
Remember to trim the {{ ingredient | trim }} before cooking!
Variables
{
    "ingredient": "  string beans  "
}
Output
Remember to trim the string beans before cooking!
Edit the template or variables to see the output change.

trimStart

This plugin removes whitespace from the beginning of the input text.

Template
[{{ shape | trimStart }}] shaped rhubarb
Variables
{
    "shape": " fish "
}
Output
[fish ] shaped rhubarb
Edit the template or variables to see the output change.

trimEnd

This plugin removes whitespace from the end of the input text.

Template
[{{ shape | trimEnd }}] shaped rhubarb
Variables
{
    "shape": " rhubarb "
}
Output
[ rhubarb] shaped rhubarb
Edit the template or variables to see the output change.

urlEscape

This plugin URL-encodes the input text.

Template
<a href="/search/?q={{ search | urlEscape }}> Search </a>
Variables
{
    "search": "how to tuna fish"
}
Output
<a href="/search/?q=how%20to%20tuna%20fish> Search </a>
Edit the template or variables to see the output change.

urlUnescape

This plugin URL-decodes the input text.

Template
You searched: {{ query | urlUnescape }}
Variables
{
    "query": "Are%20tomatoes%20secretly%20fruit%20spies%3F"
}
Output
You searched: Are tomatoes secretly fruit spies?
Edit the template or variables to see the output change.

reverse

This plugin reverses the characters in the input text.

Template
"I say, {{ phrase }}! That didn't work? Then {{ phrase | reverse }}!"
Variables
{
    "phrase": "open sesame"
}
Output
"I say, open sesame! That didn't work? Then emases nepo!"
Edit the template or variables to see the output change.

escapeHtml

This plugin escapes special HTML characters in the input text.

Template
shop for {{ html | escapeHtml }}
Variables
{
    "html": "my favorite apple variety is the <script>bobby tables apple</script>"
}
Output
shop for my favorite apple variety is the &lt;script&gt;bobby tables apple&lt;/script&gt;
Edit the template or variables to see the output change.

unescapeHtml

This plugin unescapes special HTML characters in the input text.

Template
Joke of the day: {{ html | unescapeHtml }}
Variables
{
    "html": "Can I get some peas &amp; quiet?!"
}
Output
Joke of the day: Can I get some peas & quiet?!
Edit the template or variables to see the output change.

stripHtml

This plugin removes all HTML tags from the input text.

Template
Foiled again, {{ html | stripHtml }}!
Variables
{
    "html": "<script>baked potato</script>"
}
Output
Foiled again, baked potato!
Edit the template or variables to see the output change.

truncate

This plugin truncates the input text to the specified length. It's a higher-order plugin that takes a length parameter, which is required.

Template
The Amazing {{ veggie | truncate 21 }}
Variables
{
    "veggie": "Purple Sprouting Broccoli"
}
Output
The Amazing Purple Sprouting Broc
Edit the template or variables to see the output change.