Skip to content

Commit acbb19b

Browse files
committed
fix: html in attribute not escaped
1 parent be3d0ac commit acbb19b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/render/tpl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { escapeHtml } from './utils';
2+
13
/**
24
* Render github corner
35
* @param {Object} data URL for the View Source on Github link
@@ -91,7 +93,9 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {
9193

9294
let innerHTML = '';
9395
toc.forEach(node => {
94-
innerHTML += `<li><a class="section-link" href="${node.slug}" title="${node.title}">${node.title}</a></li>`;
96+
innerHTML += `<li><a class="section-link" href="${
97+
node.slug
98+
}" title="${escapeHtml(node.title)}">${node.title}</a></li>`;
9599
if (node.children) {
96100
innerHTML += tree(node.children, tpl);
97101
}

0 commit comments

Comments
 (0)