|
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
6 | 6 | <meta name="generator" content="MarkBind 6.1.0"> |
7 | | - <meta name="viewport" content="width=device-width, initial-scale=1"><title>Page not found</title> <link rel="stylesheet" href="/markbind/css/bootstrap.min.css"><link rel="stylesheet" href="/markbind/css/codeblock-light.min.css"><link rel="stylesheet" href="/markbind/css/markbind.min.css"><link rel="stylesheet" href="/plugins/markbind-plugin-anchors/markbind-plugin-anchors.css"><link rel="stylesheet" href="/plugins/markbind-plugin-tree/markbind-plugin-tree.css"><link rel="icon" href="/favicon.ico"></head> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1"><title>Page not found</title> <link rel="stylesheet" href="/markbind/css/bootstrap.min.css"><link rel="stylesheet" href="/markbind/css/codeblock-light.min.css"><link rel="stylesheet" href="/markbind/css/markbind.min.css"><link rel="stylesheet" href="/plugins/codeBlockCopyButtons/codeBlockButtons.css"><link rel="stylesheet" href="/plugins/codeBlockWrapButtons/codeBlockButtons.css"><link rel="stylesheet" href="/plugins/markbind-plugin-anchors/markbind-plugin-anchors.css"><link rel="stylesheet" href="/plugins/markbind-plugin-tree/markbind-plugin-tree.css"><link rel="icon" href="/favicon.ico"></head> |
8 | 8 | <script> |
9 | 9 | const baseUrl = '' |
10 | 10 | </script> |
|
18 | 18 | <script> |
19 | 19 | MarkBind.setupWithSearch() |
20 | 20 | </script> |
21 | | - <script src="https://unpkg.com/@customviews-js/customviews@v1" data-base-url></script> |
| 21 | + <script src="https://unpkg.com/@customviews-js/customviews@v1" data-base-url="/"></script> |
| 22 | + <script> |
| 23 | + function copyCodeBlock(element) { |
| 24 | + const pre = element.parentElement.parentElement; |
| 25 | + const codeElement = pre.querySelector('code'); |
| 26 | + const copyButtonBody = element.querySelector('.function-btn-body'); |
| 27 | + const tooltipText = element.querySelector(".tooltiptext"); |
| 28 | + |
| 29 | + // create dummy text element to select() the text field |
| 30 | + const textElement = document.createElement('textarea'); |
| 31 | + textElement.value = codeElement.textContent; |
| 32 | + document.body.appendChild(textElement); |
| 33 | + textElement.select(); |
| 34 | + |
| 35 | + document.execCommand('copy'); |
| 36 | + document.body.removeChild(textElement); |
| 37 | + copyButtonBody.innerHTML = ` |
| 38 | + <svg |
| 39 | + xmlns="http://www.w3.org/2000/svg" |
| 40 | + width="18" |
| 41 | + height="18" |
| 42 | + viewBox="2 2 22 22" |
| 43 | + > |
| 44 | + <path d="M 19.28125 5.28125 L 9 15.5625 L 4.71875 11.28125 L 3.28125 12.71875 L 8.28125 17.71875 |
| 45 | + L 9 18.40625 L 9.71875 17.71875 L 20.71875 6.71875 Z"></path> |
| 46 | + </svg> |
| 47 | +`; |
| 48 | + console.log("Running tooltip"); |
| 49 | + tooltipText.innerText = `Copied!`; |
| 50 | + setTimeout(() => { |
| 51 | + copyButtonBody.innerHTML = ` |
| 52 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" |
| 53 | + width="18" height="18" viewBox="0 0 18 18" version="1.1"> |
| 54 | + <g id="surface1"> |
| 55 | + <path d="M 11.273438 0 L 2.546875 0 C 1.746094 0 1.089844 0.613281 1.089844 |
| 56 | + 1.363281 L 1.089844 10.910156 L 2.546875 10.910156 L 2.546875 1.363281 L 11.273438 |
| 57 | + 1.363281 Z M 13.453125 2.726562 L 5.453125 2.726562 C 4.65625 2.726562 4 3.339844 4 |
| 58 | + 4.089844 L 4 13.636719 C 4 14.386719 4.65625 15 5.453125 15 L 13.453125 15 C 14.253906 |
| 59 | + 15 14.910156 14.386719 14.910156 13.636719 L 14.910156 4.089844 C 14.910156 3.339844 |
| 60 | + 14.253906 2.726562 13.453125 2.726562 Z M 13.453125 13.636719 L 5.453125 13.636719 L |
| 61 | + 5.453125 4.089844 L 13.453125 4.089844 Z M 13.453125 13.636719 "/> |
| 62 | + </g> |
| 63 | +</svg> |
| 64 | +`; |
| 65 | + tooltipText.innerText = `Copy`; |
| 66 | + }, 3000); |
| 67 | + } |
| 68 | + </script> |
| 69 | + <script> |
| 70 | + function toggleCodeBlockWrap(element) { |
| 71 | + const pre = element.parentElement.parentElement; |
| 72 | + const tooltipText = element.querySelector(".tooltiptext"); |
| 73 | + const classList = pre.querySelector('code').classList; |
| 74 | + if (classList.contains('wrap')) { |
| 75 | + classList.remove('wrap'); |
| 76 | + tooltipText.innerText = `Wrap Text`; |
| 77 | + } else { |
| 78 | + classList.add('wrap') |
| 79 | + tooltipText.innerText = `Unwrap Text`; |
| 80 | + } |
| 81 | + } |
| 82 | + </script> |
| 83 | + <script type="module"> |
| 84 | + window.mermaidPromise = null; |
| 85 | + |
| 86 | + const loadMermaid = () => { |
| 87 | + if (window.mermaidPromise === null) { |
| 88 | + window.mermaidPromise = import('https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs') |
| 89 | + .then(({ default: mermaid }) => { |
| 90 | + mermaid.initialize({ |
| 91 | + startOnLoad: false, |
| 92 | + }); |
| 93 | + console.log('Mermaid loaded successfully'); |
| 94 | + return mermaid; |
| 95 | + }) |
| 96 | + .catch((error) => { |
| 97 | + console.error('Mermaid failed to load:', error); |
| 98 | + window.mermaidPromise = false; |
| 99 | + return null; |
| 100 | + }); |
| 101 | + } |
| 102 | + return window.mermaidPromise; |
| 103 | + }; |
| 104 | + |
| 105 | + const renderMermaidDiagrams = (elements) => { |
| 106 | + if (!elements || elements.length === 0) { |
| 107 | + return Promise.resolve(); |
| 108 | + } |
| 109 | + |
| 110 | + return loadMermaid().then(mermaid => { |
| 111 | + if (!mermaid) return; |
| 112 | + return mermaid.run({ nodes: Array.from(elements) }) |
| 113 | + .catch(err => console.error('Error rendering mermaid diagrams:', err)); |
| 114 | + }); |
| 115 | + }; |
| 116 | + |
| 117 | + const setupMermaidObserver = () => { |
| 118 | + const observer = new MutationObserver((mutations) => { |
| 119 | + let newMermaidElements = []; |
| 120 | + |
| 121 | + mutations.forEach(mutation => { |
| 122 | + if (mutation.addedNodes.length) { |
| 123 | + mutation.addedNodes.forEach(node => { |
| 124 | + if (node.nodeType === 1 && node.classList && |
| 125 | + node.classList.contains('mermaid')) { |
| 126 | + newMermaidElements.push(node); |
| 127 | + } |
| 128 | + |
| 129 | + if (node.nodeType === 1 && node.querySelectorAll) { |
| 130 | + const mermaidInNode = node.querySelectorAll('.mermaid'); |
| 131 | + if (mermaidInNode.length) { |
| 132 | + newMermaidElements = [...newMermaidElements, ...mermaidInNode]; |
| 133 | + } |
| 134 | + } |
| 135 | + }); |
| 136 | + } |
| 137 | + }); |
| 138 | + |
| 139 | + if (newMermaidElements.length > 0) { |
| 140 | + renderMermaidDiagrams(newMermaidElements); |
| 141 | + } |
| 142 | + }); |
| 143 | + |
| 144 | + observer.observe(document.body, { |
| 145 | + childList: true, |
| 146 | + subtree: true |
| 147 | + }); |
| 148 | + |
| 149 | + return observer; |
| 150 | + }; |
| 151 | + |
| 152 | + // Initialize on DOM content loaded |
| 153 | + document.addEventListener('DOMContentLoaded', () => { |
| 154 | + const existingDiagrams = document.querySelectorAll('.mermaid'); |
| 155 | + if (existingDiagrams.length > 0) { |
| 156 | + renderMermaidDiagrams(existingDiagrams); |
| 157 | + } |
| 158 | + |
| 159 | + setupMermaidObserver(); |
| 160 | + }); |
| 161 | + |
| 162 | + </script> |
22 | 163 | </html> |
0 commit comments