-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
markdown.js
26 lines (23 loc) · 890 Bytes
/
markdown.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
require('mocha');
var assert = require('assert');
var fs = require('fs');
var hbs = require('handlebars').create();
var helpers = require('..');
helpers.markdown({handlebars: hbs});
describe('markdown', function() {
describe('markdown', function() {
it('should render markdown using the {{#markdown}} block helper', function() {
var template = hbs.compile('{{#markdown}}## {{../title}}{{/markdown}}');
assert.equal(template({title: 'Markdown Test'}), '<h2>Markdown Test</h2>\n');
});
});
describe('md', function() {
it('should render markdown from a file using the {{md}} inline helper', function() {
var expected = fs.readFileSync('test/expected/simple.html', 'utf8');
var template = hbs.compile('{{{md fp}}}');
var actual = template({fp: 'test/fixtures/simple.md'});
assert.equal(actual, expected);
});
});
});