Skip to content

Commit 8aeaf89

Browse files
committed
fix: title error when sidebar link exists with image
1 parent 8cf9fd8 commit 8aeaf89

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/core/render/tpl.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {
9090
}
9191

9292
let innerHTML = '';
93+
let title = '';
9394
toc.forEach(node => {
94-
innerHTML += `<li><a class="section-link" href="${node.slug}" title="${node.title}">${node.title}</a></li>`;
95+
title = node.title.replace(/(<\/?img.*?>)/g, '');
96+
innerHTML += `<li><a class="section-link" href="${node.slug}" title="${title}">${node.title}</a></li>`;
9597
if (node.children) {
9698
innerHTML += tree(node.children, tpl);
9799
}

0 commit comments

Comments
 (0)