-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
196 lines (183 loc) · 6.29 KB
/
Gruntfile.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
* grunt-md2html
* https://github.com/bylexus/grunt-md2html
*
* Copyright (c) 2013 Alexander Schenkel
* Licensed under the MIT license.
*/
module.exports = function (grunt) {
var path = require('path');
// Project configuration.
grunt.initConfig({
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp']
},
// Configuration to be run (and then tested).
md2html: {
multiple_files: {
options: {
layout: 'spec/fixtures/layout.html',
basePath: 'spec/fixtures',
markedOptions: { gfm: true }
},
files: [
{
expand: true,
cwd: 'spec/fixtures/multiple_files',
src: ['**/*.md'],
dest: 'tmp/multiple_files',
ext: '.html'
}
]
},
include: {
options: {
basePath: 'spec/fixtures/includes',
markedOptions: { gfm: true }
},
files: [
{
expand: true,
cwd: 'spec/fixtures/includes',
src: ['**/*.md'],
filter: function (src) {
if (path.basename(src)[0] === '_') {
return false;
} else {
return true;
}
},
dest: 'tmp/includes',
ext: '.html'
}
]
},
'template-vars-no-layout': {
options: {
basePath: 'tmp/template-vars/my/base'
},
files: [
{
// single file
src: 'spec/fixtures/template-vars/one_to_one.md',
dest: 'tmp/template-vars/one_to_one.html'
},
{
// multiple file to 1 dest:
src: ['spec/fixtures/template-vars/multi_1.md', 'spec/fixtures/template-vars/multi_2.md'],
dest: 'tmp/template-vars/multiple.html'
}
]
},
'template-vars-layout': {
options: {
layout: 'spec/fixtures/template-vars/layout.html',
basePath: 'tmp/template-vars/my/base'
},
files: [
{
// single file
src: 'spec/fixtures/template-vars/one_to_one.md',
dest: 'tmp/template-vars/single-layout.html'
},
{
// multiple file to 1 dest:
src: ['spec/fixtures/template-vars/multi_1.md', 'spec/fixtures/template-vars/multi_2.md'],
dest: 'tmp/template-vars/multiple-layout.html'
}
]
},
one_file: {
options: {
separator: '\n\n'
},
files: [
{
src: ['spec/fixtures/one_file/**/*.md'],
dest: 'tmp/one_file/output.html'
}
]
},
highlight: {
options: {
highlightjs: {
enabled: true,
compressStyle: true,
style: 'paraiso-dark'
}
},
files: [
{
src: ['spec/fixtures/highlight/**/*.md'],
dest: 'tmp/highlight/output_compressed.html'
}
]
},
highlight_noncompressed: {
options: {
highlightjs: {
enabled: true,
compressStyle: false,
style: 'paraiso-dark'
}
},
files: [
{
src: ['spec/fixtures/highlight/**/*.md'],
dest: 'tmp/highlight/output.html'
}
]
},
underscoreTemplating: {
options: {
layout: 'spec/fixtures/underscoreLayout.html',
basePath: 'spec/fixtures',
markedOptions: { gfm: true },
templateData: {
basename: function (src) {
return src.substr(src.lastIndexOf(path.sep) + 1);
}
}
},
files: [
{
src: ['spec/fixtures/underscore_test/**/*.md'],
dest: 'tmp/underscore_test/output.html'
}
]
},
plantuml_local: {
options: {
plantuml: {
exec: 'plantuml'
}
},
files: [
{
src: ['spec/fixtures/plantuml/output.md'],
dest: 'tmp/plantuml/output.html'
}
]
},
plantuml_server: {
options: {
plantuml: {
renderServerUrl: 'http://www.plantuml.com/plantuml'
}
},
files: [
{
src: ['spec/fixtures/plantuml/output-server.md'],
dest: 'tmp/plantuml/output-server.html'
}
]
}
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('default', ['clean', 'md2html']);
};