@@ -42,7 +42,7 @@ export class Renderer {
42
42
* @param {string } quote
43
43
*/
44
44
blockquote ( quote ) {
45
- return ' <blockquote>\n' + quote + ' </blockquote>\n' ;
45
+ return ` <blockquote>\n${ quote } </blockquote>\n` ;
46
46
}
47
47
48
48
html ( html ) {
@@ -57,19 +57,12 @@ export class Renderer {
57
57
*/
58
58
heading ( text , level , raw , slugger ) {
59
59
if ( this . options . headerIds ) {
60
- return '<h'
61
- + level
62
- + ' id="'
63
- + this . options . headerPrefix
64
- + slugger . slug ( raw )
65
- + '">'
66
- + text
67
- + '</h'
68
- + level
69
- + '>\n' ;
60
+ const id = this . options . headerPrefix + slugger . slug ( raw ) ;
61
+ return `<h${ level } id="${ id } ">${ text } </h${ level } >\n` ;
70
62
}
63
+
71
64
// ignore IDs
72
- return '<h' + level + '>' + text + ' </h' + level + ' >\n' ;
65
+ return `<h ${ level } > ${ text } </h${ level } >\n` ;
73
66
}
74
67
75
68
hr ( ) {
@@ -86,7 +79,7 @@ export class Renderer {
86
79
* @param {string } text
87
80
*/
88
81
listitem ( text ) {
89
- return ' <li>' + text + ' </li>\n' ;
82
+ return ` <li>${ text } </li>\n` ;
90
83
}
91
84
92
85
checkbox ( checked ) {
@@ -101,15 +94,15 @@ export class Renderer {
101
94
* @param {string } text
102
95
*/
103
96
paragraph ( text ) {
104
- return ' <p>' + text + ' </p>\n' ;
97
+ return ` <p>${ text } </p>\n` ;
105
98
}
106
99
107
100
/**
108
101
* @param {string } header
109
102
* @param {string } body
110
103
*/
111
104
table ( header , body ) {
112
- if ( body ) body = ' <tbody>' + body + ' </tbody>' ;
105
+ if ( body ) body = ` <tbody>${ body } </tbody>` ;
113
106
114
107
return '<table>\n'
115
108
+ '<thead>\n'
@@ -123,37 +116,37 @@ export class Renderer {
123
116
* @param {string } content
124
117
*/
125
118
tablerow ( content ) {
126
- return ' <tr>\n' + content + ' </tr>\n' ;
119
+ return ` <tr>\n${ content } </tr>\n` ;
127
120
}
128
121
129
122
tablecell ( content , flags ) {
130
123
const type = flags . header ? 'th' : 'td' ;
131
124
const tag = flags . align
132
- ? '<' + type + ' align="' + flags . align + '">'
133
- : '<' + type + '>' ;
134
- return tag + content + '</' + type + ' >\n' ;
125
+ ? `< ${ type } align="${ flags . align } ">`
126
+ : `< ${ type } >` ;
127
+ return tag + content + `</ ${ type } >\n` ;
135
128
}
136
129
137
130
/**
138
131
* span level renderer
139
132
* @param {string } text
140
133
*/
141
134
strong ( text ) {
142
- return ' <strong>' + text + ' </strong>' ;
135
+ return ` <strong>${ text } </strong>` ;
143
136
}
144
137
145
138
/**
146
139
* @param {string } text
147
140
*/
148
141
em ( text ) {
149
- return ' <em>' + text + ' </em>' ;
142
+ return ` <em>${ text } </em>` ;
150
143
}
151
144
152
145
/**
153
146
* @param {string } text
154
147
*/
155
148
codespan ( text ) {
156
- return ' <code>' + text + ' </code>' ;
149
+ return ` <code>${ text } </code>` ;
157
150
}
158
151
159
152
br ( ) {
@@ -164,7 +157,7 @@ export class Renderer {
164
157
* @param {string } text
165
158
*/
166
159
del ( text ) {
167
- return ' <del>' + text + ' </del>' ;
160
+ return ` <del>${ text } </del>` ;
168
161
}
169
162
170
163
/**
@@ -196,9 +189,9 @@ export class Renderer {
196
189
return text ;
197
190
}
198
191
199
- let out = ' <img src="' + href + ' " alt="' + text + '"' ;
192
+ let out = ` <img src="${ href } " alt="${ text } "` ;
200
193
if ( title ) {
201
- out += ' title="' + title + '"' ;
194
+ out += ` title="${ title } "` ;
202
195
}
203
196
out += this . options . xhtml ? '/>' : '>' ;
204
197
return out ;
0 commit comments