Skip to content

Commit b0dfb53

Browse files
authored
Merge pull request #393 from Tencent/fix-header-anchor-id
Fix header anchor
2 parents 21a505a + d28c488 commit b0dfb53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/hooks/Header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ export default class Header extends ParagraphBase {
111111
const replaceFootNote = /~fn#([0-9]+)#/g;
112112
anchorID = this.generateIDNoDup(headerTextRaw.replace(replaceFootNote, ''));
113113
}
114-
anchorID = `safe_${anchorID}`; // transform header id to avoid being sanitized
114+
const safeAnchorID = `safe_${anchorID}`; // transform header id to avoid being sanitized
115115
const sign = this.$engine.md5(`${level}-${processedText.sign}-${anchorID}-${dataLines}`);
116116
const result = [
117-
`<h${level} id="${anchorID}" data-sign="${sign}" data-lines="${dataLines}">`,
117+
`<h${level} id="${safeAnchorID}" data-sign="${sign}" data-lines="${dataLines}">`,
118118
this.$getAnchor(anchorID),
119119
`${html}`,
120120
`</h${level}>`,

0 commit comments

Comments
 (0)