diff --git a/js/customElements/inline-code.js b/js/customElements/inline-code.js index 1beb51fb95ee99e96db10995be63e41eebcc4c3c..940f276ae154a03dedb49e53ef79e3f315f6c862 100644 --- a/js/customElements/inline-code.js +++ b/js/customElements/inline-code.js @@ -1,7 +1,14 @@ class InlineCode extends HTMLElement { constructor() { super(); - this.innerHTML = "<code class=\"language-text\">" + this.innerHTML + "</code>"; + const codeElement = document.createElement("code"); + if (this.hasAttribute("language")) { + codeElement.classList.add(this.getAttribute("language")); + } else { + codeElement.classList.add("language-text"); + } + codeElement.innerHTML = this.innerHTML; + this.appendChild(codeElement); } }