zerodevx / zero-md

Ridiculously simple zero-config markdown displayer
https://zerodevx.github.io/zero-md/
ISC License
436 stars 48 forks source link

Issue with Latex rendering #115

Closed sujaygarlanka closed 3 months ago

sujaygarlanka commented 4 months ago

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!

sujaygarlanka commented 4 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.

zerodevx commented 4 months ago

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>
sujaygarlanka commented 4 months ago

Interesting. It seems to occur when I add the