fix: render of katex (#390)

This commit is contained in:
YangFong 2024-09-08 09:45:59 +08:00 committed by GitHub
parent 744785bd84
commit 33206c7857
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 12 deletions

View File

@ -15,12 +15,6 @@
rel="apple-touch-icon-precomposed"
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/md/images/1648303220922-7e14aefa-816e-44c1-8604-ade709ca1c69.png"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css"
integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+"
crossorigin="anonymous"
/>
<style>
.loading {
position: fixed;
@ -93,11 +87,12 @@
</script>
<script>
MathJax = {
loader: { load: ['[tex]/ams'] },
tex: { packages: { '[+]': ['ams'] }, tags: 'ams' },
svg: { fontCache: 'none' },
tex: { tags: 'ams' },
}
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<script type="module" src="/src/main.js"></script>
</body>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/wechatsync/article-syncjs@latest/dist/main.js"></script>

View File

@ -16,9 +16,8 @@ function createRenderer(display) {
if (display) {
return `<section style="text-align: center; overflow: auto;">${svg.outerHTML}</section>`
}
else {
return `<span style="display: inline-block; vertical-align: middle; line-height: 1;">${svg.outerHTML}</span>`
}
return `<span style="vertical-align: middle; line-height: 1;">${svg.outerHTML}</span>`
}
}

View File

@ -80,7 +80,7 @@ function transform(legend: string, text: string | null, title: string | null): s
}
const macCodeSvg = `
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="45px" height="13px" viewBox="0 0 450 130">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="45px" height="13px" viewBox="0 0 450 130">
<ellipse cx="65" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)" />
<ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)" />
<ellipse cx="385" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)" />