diff --git a/index.html b/index.html
index 07d9acd..54e6301 100644
--- a/index.html
+++ b/index.html
@@ -2476,24 +2476,31 @@
Mermaid Requirement Diagram
document.querySelectorAll('pre > code').forEach(function(e) {
let codeText = '';
- e.childNodes.forEach(function(c) {
- c.childNodes.forEach(function(n, i) {
- if (i === 0) {
- return
- }
- codeText += n.innerText;
- })
- })
- let copyElement = document.createElement('div');
- copyElement.innerHTML = ``;
- e.parentNode.insertBefore(copyElement.firstChild, e);
+ Array.from(e.childNodes).forEach(function(c) {
+ if (c.nodeName === '#text') {
+ codeText += c.nodeValue;
+ } else {
+ Array.from(c.childNodes).forEach(function(n, i) {
+ if (i !== 0) {
+ codeText += n.textContent;
+ }
+ });
+ }
+ });
+ let textarea = document.createElement('textarea');
+ textarea.value = codeText;
+
+ const copyElement = document.createElement("div");
+ copyElement.className = "pre-code-copy";
+ copyElement.innerHTML = `
+
+
+ `;
+
+ copyElement.insertAdjacentElement("afterbegin", textarea);
+ e.parentNode.insertBefore(copyElement, e);
});