Html Helpers
{{attr}}
Stringify attributes from the options hash into an HTML attribute string.
Params
options{Object}: Options object with ahashproperty containing key-value pairsreturns{String}: Space-prefixed attribute string, or empty string if no attributes
Example
Output
<div class="container" id="main">div>
You can also use variables:
Output
<button class="btn-primary" type="submit">Clickbutton>
{{css}}
Generate tags for stylesheets. Supports both CSS and LESS files.
Params
list{String|Array}: One or more stylesheet paths/URLsreturns{String}: One or moretags
Example
Single stylesheet:
{{css "styles/main.css"}}
Output
<link type="text/css" rel="stylesheet" href="styles/main.css">
Multiple stylesheets:
{{css stylesheets}}
Output
<link type="text/css" rel="stylesheet" href="reset.css">
<link type="text/css" rel="stylesheet" href="theme.css">
<link type="text/css" rel="stylesheet" href="app.css">
LESS files are automatically detected:
{{css "styles/theme.less"}}
Output
<link type="text/css" rel="stylesheet/less" href="styles/theme.less">
{{js}}
Generate tags for JavaScript files.
Params
context{String|Array|Object}: Script path(s) or options object withsrcattributereturns{String}: One or moretags
Example
Single script:
{{js "app.js"}}
Output
<script src="app.js">script>
Multiple scripts:
{{js scripts}}
Output
<script src="vendor.js">script>
<script src="utils.js">script>
<script src="app.js">script>
Using the src attribute:
{{js src="bundle.js"}}
Output
<script src="bundle.js">script>
{{sanitize}}
Strip all HTML tags from a string, preserving only the text content.
Params
str{String}: The string containing HTML to sanitizereturns{String}: Plain text with all HTML tags removed
Example
{{sanitize "Hello World!
"}}
Output
Hello World!
Extracting text from HTML markup:
{{sanitize richText}}
Output
<p>Important: Check the docsp>
Note: This helper removes HTML tags but preserves all text content, including text inside or tags. It is not a security sanitizer for untrusted input.
{{ul}}
Block helper for creating unordered lists.
Params
context{Array}: Array of items to render as list itemsoptions{Object}: Options object; supports HTML attributes via hashreturns{String}: Completeelement withchildren
Example
With an array of strings:
{{#ul fruits}}{{this}}{{/ul}}
Output
<ul><li>Appleli>
<li>Bananali>
<li>Cherryli>ul>
With objects and custom attributes:
{{#ul users class="user-list"}}{{name}}{{/ul}}
Output
<ul class="user-list"><li>Aliceli>
<li>Bobli>ul>
{{ol}}
Block helper for creating ordered lists.
Params
context{Array}: Array of items to render as list itemsoptions{Object}: Options object; supports HTML attributes via hashreturns{String}: Completeelement withchildren
Example
{{#ol steps class="recipe-steps"}}{{this}}{{/ol}}
Output
<ol class="recipe-steps"><li>Mix ingredientsli>
<li>Bake at 350°Fli>
<li>Let coolli>ol>
{{thumbnailImage}}
Generate a element with a thumbnail image, optional link to full-size image, and optional caption.
Params
context{Object}: Configuration object with the following properties:id{String}: Unique identifier for the figure elementalt{String}: Alt text for the imagethumbnail{String}: URL of the thumbnail imagesize{Object}: Object withwidthandheightpropertiesfull{String} (optional): URL of the full-size image (creates a link if provided)caption{String} (optional): Caption text for the imageclasses{Object} (optional): CSS classes forfigure,image, andlinkelements
returns{String}: Completeelement
Example
Basic thumbnail with link and caption:
{{thumbnailImage image}}
With context:
{
"image": {
"id": "hero",
"alt": "Mountain landscape",
"thumbnail": "/images/mountain-thumb.jpg",
"size": { "width": 200, "height": 150 },
"full": "/images/mountain-full.jpg",
"caption": "View from the summit"
}
}
Output
<figure id="image-hero">
<a href="/images/mountain-full.jpg" rel="thumbnail">
<img alt="Mountain landscape" src="/images/mountain-thumb.jpg" width="200" height="150">
a>
<figcaption>View from the summitfigcaption>
figure>
With custom CSS classes:
{
"image": {
"id": "profile",
"alt": "User avatar",
"thumbnail": "/avatars/user.jpg",
"size": { "width": 100, "height": 100 },
"full": "/avatars/user-large.jpg",
"classes": {
"figure": ["avatar-container", "rounded"],
"image": ["avatar-img"],
"link": ["avatar-link"]
}
}
}
Output
<figure id="image-profile" class="avatar-container rounded">
<a href="/avatars/user-large.jpg" rel="thumbnail" class="avatar-link">
<img alt="User avatar" src="/avatars/user.jpg" width="100" height="100" class="avatar-img">
a>
figure>