#markdown #handlebars #templating #template #web #markdown-html

handlebars-markdown-helper

A helper for handlebars that adds markdown rendering

11 releases (6 breaking)

Uses old Rust 2015

0.7.0 Jul 23, 2018
0.6.1 Jun 3, 2017
0.6.0 May 22, 2017
0.5.0 Dec 22, 2016
0.1.3 Nov 13, 2015

#50 in #handlebars

MIT license

54KB

master status

Handlebars Markdown Helper

The handlebars crate provides easy templating for any file type. This crate provides a helper for rendering a variable containing markdown into HTML within a temlpate.

Example

extern crate handlebars_markdown_helper;
use handlebars_markdown_helper;

let mut handlebars = Handlebars::new();
handlebars.register_helper("markdown", Box::new(handlebars_markdown_helper::markdown_helper));
handlebars.register_template("t0", "{{markdown x}}");

let mut m :BTreeMap<String, String> = BTreeMap::new();
m.insert("x".into(), "# wow\n\n## second wow".into());

let r0 = handlebars.render("t0", &m);
assert_eq!(r0.ok().unwrap(), "<h1>wow</h1>\n<h2>second wow</h2>\n".to_string());

deps

Dependencies

~6–8MB
~150K SLoC