Closed sujaygarlanka closed 3 months ago
@zerodevx I believe this line https://github.com/zerodevx/zero-md/blob/1d79b51cacfbc5892919dc727d40d9fbd12b7003/src/lib/zero-md.js#L138C3-L138C13 should set the option of output to just "mathml" because the default is not rendering correctly. The katex option can be found here https://katex.org/docs/options. Create a PR here #116.
Hey, I tried reproducing this issue here: https://plnkr.co/edit/5mton86H2ZFgbC4G but I'm not seeing those artefacts.
You can set katex
options like so (I should document better):
<head>
<script type="module">
import ZeroMd from "https://cdn.jsdelivr.net/npm/zero-md@3"
customElements.define('zero-md', class extends ZeroMd {
parseKatex(text) {
return this.katex.renderToString(text, {
throwOnError: false,
output: 'mathml',
...
})
}
})
</script>
</head>
Interesting. It seems to occur when I add the tags like below for custom styling. Also, thanks for the example above.
<zero-md src="test.md">
<template>
</template>
</zero-md>
Then that's probably it. katex
requires its stylesheet. From your link, I see you're rendering into light dom. Try adding this into head
:
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css" />
</head>
Going to mark this as resolved. Feel free to re-open if needed.
This page https://sujaygarlanka.com/projects.html is rendering the file here, yet there seems to be a difference. It seems to repeat the markdown in addition rendering it. Thanks!