From d28c4883dd0c215726ec4e5f41914026b6a94104 Mon Sep 17 00:00:00 2001 From: kiritocui Date: Fri, 17 Feb 2023 14:37:57 +0800 Subject: [PATCH] fix: unity header anchor safe id --- src/core/hooks/Header.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hooks/Header.js b/src/core/hooks/Header.js index 5ca23ecfb..65c978244 100644 --- a/src/core/hooks/Header.js +++ b/src/core/hooks/Header.js @@ -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 = [ - ``, + ``, this.$getAnchor(anchorID), `${html}`, ``,