Skip to content

Commit 7918433

Browse files
Prepare public version
1 parent 36ee270 commit 7918433

26 files changed

+1319
-149
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Gruntfile.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
var marked = require('marked');
2+
var Handlebars = require('handlebars');
3+
4+
module.exports = function (grunt) {
5+
grunt.initConfig({
6+
mark: {
7+
all: {
8+
files: [{
9+
src: 'README.md',
10+
dest: 'README.html'
11+
}],
12+
template: 'template.html',
13+
options: {
14+
gfm: true
15+
}
16+
}
17+
},
18+
watch: {
19+
compass: {
20+
files: ['*.md'],
21+
tasks: ['mark'],
22+
options: {}
23+
}
24+
}
25+
});
26+
27+
grunt.registerMultiTask('mark', 'Process markdown', function () {
28+
var data = this.data;
29+
marked.setOptions(data.options);
30+
31+
var template = null;
32+
if (data.template) {
33+
template = Handlebars.compile([
34+
'<!-- THIS IS A GENERATED FILE - DO NOT EDIT -->',
35+
grunt.file.read(data.template)
36+
].join('\n'));
37+
}
38+
39+
data.files.forEach(function(file) {
40+
var content = marked(grunt.file.read(file.src[0]))
41+
42+
if (template) {
43+
content = template({ markdown: content });
44+
}
45+
46+
grunt.file.write(
47+
file.dest,
48+
content
49+
);
50+
});
51+
});
52+
53+
grunt.loadNpmTasks('grunt-contrib-watch');
54+
55+
grunt.registerTask('default', ['mark', 'watch']);
56+
};

0 commit comments

Comments
 (0)