CAD97 / katex-doc

XaaS for KaTeX on docs.rs
12 stars 1 forks source link

Should the delimiters change? #2

Open CAD97 opened 6 years ago

CAD97 commented 6 years ago

If we decide to support AsciiMath (#1), then the display-math ```math is ambiguous.

Options:

If that's what pulldown-cmark does, then I think the third option is the best one.

CAD97 commented 6 years ago

What does GitHub do?

f(x) = \int_{-\infty}^\infty
  \hat f(\xi)\,e^{2 \pi i \xi x}
  \,d\xi
<pre lang="math,katex"><code>f(x) = \int_{-\infty}^\infty
  \hat f(\xi)\,e^{2 \pi i \xi x}
  \,d\xi
</code></pre>
CAD97 commented 6 years ago

Reusing class="language-katex" is probably not a good idea, as that should render the code block as katex code, not interpret it. Same with class="language-asciimath". Someone might do syntax highlighting for it, or want to show off their asciimath code.

CAD97 commented 6 years ago

Inline math is a lot more up in the air.

I chose $1+1$, as its fallback to code-blocks parallels what seems like the obvious choice for display-style, that is the <code> block with class language-math, as that's what it is. But for inline code blocks, CommonMark doesn't give a way to specify the class of the rendered HTML node.

If we add AsciiMath, then we need different markers for inline AsciiMath.