mrdocs::js::registerHelper

Register a JavaScript helper function

Synopsis

Declared in <mrdocs/Support/JavaScript.hpp>
Expected<void, Error>
registerHelper(
    mrdocs::Handlebars& hbs,
    std::string_view name,
    Context& ctx,
    std::string_view script);

Description

This function registers a JavaScript function as a helper function that can be called from Handlebars templates.

Return Value

A container holding an error or a value.

Parameters

Name Description
hbs The Handlebars instance to register the helper into
name The name of the helper function
ctx The JavaScript context to use
script The JavaScript code that defines the helper function

Created with MrDocs