website/js/customElements/inline-code.js

16 lines
476 B
JavaScript
Raw Normal View History

2022-01-29 21:31:48 +01:00
class InlineCode extends HTMLElement {
constructor() {
super();
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);
2022-01-29 21:31:48 +01:00
}
}
customElements.define("jl-code", InlineCode);