This component is a Handlebars helper that allows us to render Markdown
content as HTML. This helper is wired into fluid.express.handlebars
by default. Here are examples of how you might
use it in a handlebars template:
The last example, in which HTML and markdown are mixed, will only work if:
- You have passed the appropriate options to the helper (see below).
- You use triple braces so that HTML content is not escaped by handlebars.
Option | Type | Description |
---|---|---|
markdownItOptions |
{Object} |
The options to pass to Markdown-it when creating the renderer. See the Markdown-it documentation for details. |
markdownItOptions.html |
{Boolean} |
Whether to allow raw HTML. Defaults to false . See example below. |
If you want to simply enable HTML content and otherwise use the defaults for fluid.express.handlebars
, you can use the
distributeOptions
mechanism as shown in the following
example:
fluid.defaults("my.express.instance", {
gradeNames: ["fluid.express"],
distributeOptions: {
record: true,
target: "{that fluid.handlebars.helper.md}.options.markdownItOptions.html"
},
components: {
handlebars: {
type: "fluid.express.handlebars"
}
}
});