Skip to content

Commit 79b3893

Browse files
docs(fix): potential fix
for code scanning alert no. 1: Incomplete multi-character sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent df59f99 commit 79b3893

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/app/shared/services/markdown.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ function extractHeadings(html: string): TocItem[] {
244244
while ((match = headingPattern.exec(html)) !== null) {
245245
const level = parseInt(match[1], 10);
246246
const id = match[2];
247-
const label = match[3].replace(/<[^>]+>/g, '').trim();
247+
const labelContainer = document.createElement('div');
248+
labelContainer.innerHTML = match[3];
249+
const label = (labelContainer.textContent ?? '').trim();
248250
if (id && label) {
249251
items.push({ id, label, level });
250252
}

0 commit comments

Comments
 (0)