diff --git a/src/extensions/libs/markdownItAnchor.js b/src/extensions/libs/markdownItAnchor.js
index 41856fb7..fd636c6b 100644
--- a/src/extensions/libs/markdownItAnchor.js
+++ b/src/extensions/libs/markdownItAnchor.js
@@ -56,6 +56,7 @@ export default (md) => {
// According to http://pandoc.org/README.html#extension-auto_identifiers
let slug = headingContent
+ .replace(/]*>/g, '') // Replace image to empty
.replace(/\s/g, '-') // Replace all spaces and newlines with hyphens
.replace(/[\0-,/:-@[-^`{-~]/g, '') // Remove all punctuation, except underscores, hyphens, and periods
.toLowerCase(); // Convert all alphabetic characters to lowercase
diff --git a/src/services/editorSvc.js b/src/services/editorSvc.js
index 2de82a14..536ced66 100644
--- a/src/services/editorSvc.js
+++ b/src/services/editorSvc.js
@@ -233,7 +233,12 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
const clonedElt = headingElt.cloneNode(true);
clonedElt.removeAttribute('id');
sectionTocElt.appendChild(clonedElt);
- headingElt.innerHTML = `${headingElt.innerHTML}`;
+ const prefixElt = document.createElement('span');
+ prefixElt.className = 'prefix';
+ headingElt.insertBefore(prefixElt, headingElt.firstChild);
+ const suffixElt = document.createElement('span');
+ suffixElt.className = 'suffix';
+ headingElt.appendChild(suffixElt);
}
if (insertBeforeTocElt) {
this.tocElt.insertBefore(sectionTocElt, insertBeforeTocElt);