showdown-katex icon indicating copy to clipboard operation
showdown-katex copied to clipboard

"not equal sign" didn't render properly

Open azophy opened this issue 4 years ago • 6 comments

When I tried to write \ne in latex format or != in asciimath format, the strike in the equal sign was misaligned. This happen even on the demo page on https://obedm503.github.io/showdown-katex/#sandbox

2020-03-08_55

azophy avatar Mar 08 '20 07:03 azophy

I've confirmed this is an issue. I tried quickly figuring out what may be causing it, but have not been able to. It seems to be related to KaTeX/KaTeX#1842. Any help is appreciated.

Until this issue is fixed, you can use \cancel{=} instead (even in asciimath blocks).

What browser and OS are you using?

obedm503 avatar Mar 09 '20 01:03 obedm503

It's interesting that if we use renderMathInElement from katex directly, this error doesn't seem to occur.

lriuui0x0 avatar Mar 12 '20 19:03 lriuui0x0

@lriuui0x0 can you provide some more details? you mentioned using renderMathInElement directly, but this package already uses renderMathInElement

I've been looking into this issue without much success. how did you get renderMathInElement to work?

obedm503 avatar Mar 24 '20 20:03 obedm503

@obedm503 Yep I had code like below to render maths. code.math is the class that's assigned when you do ```math with showdown.

Array.from(text_root.querySelectorAll('code.math')).forEach(code => {
    let p = document.createElement('p');
    katex_html = katex.renderToString(code.innerText, {
        displayMode: true,
        throwOnError: false,
    });
    p.innerHTML = katex_html;
    code.replaceWith(p);
});
renderMathInElement(text_root, {
    throwOnError: false,
    delimiters: [
        {left: "$", right: "$", display: false},
    ]
});

lriuui0x0 avatar Mar 24 '20 22:03 lriuui0x0

what version of katex are you using?

obedm503 avatar Mar 24 '20 23:03 obedm503

@obedm503 Latest. I'm using <script src="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.js"></script>

lriuui0x0 avatar Mar 25 '20 01:03 lriuui0x0