Install mangony-hbs-helpers
with
npm install mangony-hbs-helpers --save-dev
Helpers are generated by passing in an instance of Handlebars.
handlebars
Handlebars
- An instance of Handlebars.
Both generates an object containing the mangony helpers and registers them with Handlebars automatically.
var handlebars = require('handlebars');
var helpers = require('mangony-hbs-helpers');
helpers.register(handlebars);
This helper cleans up your html block by indenting and deleting spaces and line breaks.
string
String
- First part of a path.string2
String
- Second part of a path.goUp
Number
- You can go specific folders up by defining the hashgoUp
.
This helper concatenate two strings by adding a /
.
string
String
- First part of a string.string2
String
- Second part of a string.
This helper concatenate two strings.
context
Object
- Log a specific context and display the value of the context.
This helper debugs a passed context.
path
String
- Path to a file.
This helper embeds the file content.
array
Array
- Array you want to filter.by
String
- Filter value.reverse
Boolean
- If you want to reverse the result set it to true.
This helper filters an array after a specific property value.
from
Number
- Starting index for the loop.to
Number
- End index for the loop.incr
Number
Optional - Increment number for the loop.
This helper provides a for loop which can be used to repeat content.
from
String
- Id of your type.typeof
String
- Type of your data object.
This helper allows you to get the whole data object of partials, pages, data or layouts.
path
String
- Absolute or relative URL path to file.
This helper prints out an URL (http://
, https://
, mailto:
) or the assets
prefix.
type
String
- Language of code block.origin
Boolean
- When set to true it returns the highlighted block and the origin oneescapeHTML
Boolean
- Escape HTML when set to true
This helper uses highlight.js
to return a syntax highlighted code block.
idx
Number
- index number.
This helper returns a boolean if the element is the first one in a loop.
file
String
- Path to file.
This helper returns a boolean if the file exists under the path.
start
Number
- Starting index.end
Number
- End index.data
[Object|Array]
- Data object/array which will be iterate.
This helper returns a limited output from your data object.
filepath
String
- Path to your markdown file.context
Object
- Data context which you can use in your markdown file. When nothing provided it falls back to root data object.
This helper renders a markdown file into HTML by using markdown-it
, markdown-it-attrs
and markdown-it-named-headers
.
It supports handlebars syntax in it and highlights code snippets by using higlightjs
.
data
String
- Markdown content.
This helper renders a markdown content into HTML by using markdown-it
, markdown-it-attrs
and markdown-it-named-headers
.
data
Object
- Data object.with
Object|String
- JSON string or object which will be merged withdata
This helper merges two objects into one to extend the context.
data
Object
- Data object.with
Object|String
- JSON string or object which will be merged withdata
.arrayMerge
String
- You can define how to merge arrays (overwrite
,keep
,extend
). The default merging strategy combines the arrays by usingextend
andoverwrite
at the same time.
This helper merges two objects into one to extend the context by using a deepmerge package.
format
String
- Date format you like to get.
This helper displays the date of now and uses moment.js.
object
Object
- Object which gets flattened to an array.
This helper flattens an object to an array.
pictures
Array
- Array of all pictures.presets
Array
- Array of presets you want to display.
This helper returns an array with the images you provided as parameter. See image-size-export
for a simple picture module.
This helper returns a random number between 0 - 1000.
arr
Array
- Array which you want to sort.prop
String
- String which äÄ'Ä
This helper flattens an object to an array.
JSON
Object
- JSON/JS object.
This helper makes a string out of JSON objects.
n
Number
- Repeating number.
This helper repeats the content n times.
Mangony is yet another static site generator - fast, simple and powerful: https://github.com/Sebastian-Fitzner/mangony
see LICENSE.md.