Skip to content

Commit 67e79b8

Browse files
committed
Add template tag for HTML to enable syntax highlighting
1 parent d44be8f commit 67e79b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/template.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ function getAssetContent(filename) {
2626
return fs.readFileSync(assetPath, 'utf8');
2727
}
2828

29+
function html(strings, ...values) {
30+
return strings.map((string, index) => `${string}${values[index] || ''}`).join('')
31+
}
32+
2933
function getScript(filename, mode) {
3034
if (mode === 'static') {
3135
return `<!-- ${_.escape(filename)} -->
@@ -36,7 +40,7 @@ function getScript(filename, mode) {
3640
}
3741

3842
function renderViewer({title, enableWebSocket, chartData, defaultSizes, mode} = {}) {
39-
return `<!DOCTYPE html>
43+
return html`<!DOCTYPE html>
4044
<html>
4145
<head>
4246
<meta charset="UTF-8"/>

0 commit comments

Comments
 (0)