| 127 | } |
| 128 | |
| 129 | async function getKatexAndTexmathModules() { |
| 130 | if (!mathModulesPromise) { |
| 131 | mathModulesPromise = Promise.all([ |
| 132 | import("katex").then(({ default: katex }) => katex), |
| 133 | import("markdown-it-texmath").then( |
| 134 | ({ default: markdownItTexmath }) => markdownItTexmath, |
| 135 | ), |
| 136 | ]).then(([katex, markdownItTexmath]) => ({ |
| 137 | katex, |
| 138 | markdownItTexmath, |
| 139 | })); |
| 140 | mathModulesPromise = mathModulesPromise.catch((error) => { |
| 141 | mathModulesPromise = null; |
| 142 | throw error; |
| 143 | }); |
| 144 | } |
| 145 | |
| 146 | return mathModulesPromise; |
| 147 | } |
| 148 | |
| 149 | function createMarkdownIt({ katex = null, markdownItTexmath = null } = {}) { |
| 150 | const md = markdownIt({ |