Skip to content

Commit

Permalink
fix: unity header anchor safe id
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawei686 committed Feb 17, 2023
1 parent 21a505a commit d28c488
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/hooks/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export default class Header extends ParagraphBase {
const replaceFootNote = /~fn#([0-9]+)#/g;
anchorID = this.generateIDNoDup(headerTextRaw.replace(replaceFootNote, ''));
}
anchorID = `safe_${anchorID}`; // transform header id to avoid being sanitized
const safeAnchorID = `safe_${anchorID}`; // transform header id to avoid being sanitized
const sign = this.$engine.md5(`${level}-${processedText.sign}-${anchorID}-${dataLines}`);
const result = [
`<h${level} id="${anchorID}" data-sign="${sign}" data-lines="${dataLines}">`,
`<h${level} id="${safeAnchorID}" data-sign="${sign}" data-lines="${dataLines}">`,
this.$getAnchor(anchorID),
`${html}`,
`</h${level}>`,
Expand Down

0 comments on commit d28c488

Please sign in to comment.