-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
65 lines (63 loc) · 1.93 KB
/
index.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
function Renderer (options) {
this.options = options || {};
this.whitespaceDelimiter = this.options.spaces ? ' ' : '\n';
this.showImageText = (typeof this.options !== 'undefined') ? this.options.showImageText : true;
}
Renderer.prototype.code = function(code, lang, escaped) {
return this.whitespaceDelimiter + this.whitespaceDelimiter + code + this.whitespaceDelimiter + this.whitespaceDelimiter;
}
Renderer.prototype.blockquote = function(quote) {
return '\t' + quote + this.whitespaceDelimiter;
}
Renderer.prototype.html = function(html) {
return html;
}
Renderer.prototype.heading = function(text, level, raw) {
return text;
}
Renderer.prototype.hr = function() {
return this.whitespaceDelimiter + this.whitespaceDelimiter;
}
Renderer.prototype.list = function(body, ordered) {
return body;
}
Renderer.prototype.listitem = function(text) {
return '\t' + text + this.whitespaceDelimiter;
}
Renderer.prototype.paragraph = function(text) {
return this.whitespaceDelimiter + text + this.whitespaceDelimiter;
}
Renderer.prototype.table = function(header, body) {
return this.whitespaceDelimiter + header + this.whitespaceDelimiter + body + this.whitespaceDelimiter;
}
Renderer.prototype.tablerow = function(content) {
return content + this.whitespaceDelimiter;
}
Renderer.prototype.tablecell = function(content, flags) {
return content + '\t';
}
Renderer.prototype.strong = function(text) {
return text;
}
Renderer.prototype.em = function(text) {
return text;
}
Renderer.prototype.codespan = function(text) {
return text;
}
Renderer.prototype.br = function() {
return this.whitespaceDelimiter + this.whitespaceDelimiter;
}
Renderer.prototype.del = function(text) {
return text;
}
Renderer.prototype.link = function(href, title, text) {
return text;
}
Renderer.prototype.image = function(href, title, text) {
return this.showImageText ? text : '';
}
Renderer.prototype.text = function(text) {
return text;
}
module.exports = Renderer;