This commit is contained in:
2025-07-05 22:32:51 +09:00
parent 55a78b2a02
commit 574e04fa19
21 changed files with 556 additions and 541 deletions

View File

@@ -4,21 +4,21 @@
import renderMathInElement from 'katex/contrib/auto-render'
let renderedMath: string | undefined
if ( raw.startsWith('`\\(') || raw.startsWith('`\\[') || raw.startsWith('`$') || raw.startsWith('`$$') ) {
let dummy = document.createElement("div")
if (raw.startsWith('`\\(') || raw.startsWith('`\\[') || raw.startsWith('`$') || raw.startsWith('`$$')) {
const dummy = document.createElement('div')
dummy.textContent = raw.replace(/`/g, '')
renderMathInElement(dummy, {
delimiters: [
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true},
{left: '$', right: '$', display: false},
{left: '$$', right: '$$', display: true}
],
throwOnError : false,
output: "html"
})
renderedMath = dummy.innerHTML;
dummy.remove();
delimiters: [
{ left: '\\(', right: '\\)', display: false },
{ left: '\\[', right: '\\]', display: true },
{ left: '$', right: '$', display: false },
{ left: '$$', right: '$$', display: true }
],
throwOnError: false,
output: 'html'
})
renderedMath = dummy.innerHTML
dummy.remove()
}
</script>