PR to add asciimath

I’ve just submitted a pull request to modify the plugin so that it can process input expressed in asciimath, as well as LaTeX. The code is on GitHub and (for a brief time only) you can see it in action on this temporary discourse instance.

I mention it here because, as you said:

I chose to delimit asciimath input with a single percent sign (%). The aciimath webpage indicates a preference for a backtick (`); that seems a poor choice because markdown typically uses this to denote inline code. There’s not a whole lot of other choices of single character delimiters that aren’t either very commonly used in math (like +/-/=) or captured by discourse for some special purpose (like @ or #). I went with the percent sign, in part, because it’s right next to the dollar sign used for TeX. Note that you can still use a percent sign in math input by escaping it with a backslash.


Hmm :thinking: what if we did something like %` some math ` , I know it is 2 keys but it would save us from escaping percents and we could have a block form with % triple backtick?

What do other markdown implementations do like math stack exchange etc?


One thing that I like about the code the way I’ve set it up now is that it uses your original inlineMath function almost verbatim. I’ve just added a third argument to specify the delimiter - 36 for $ for LaTeX and 37 for % for asciimath. I rather like that simplicity and multi-purposing of code. Also, I’m a bit of a novice at this and not sure how much time it would take me to figure out to scan two symbols.

I’m definitely open to using some other single symbol; I’m just not sure of a better choice.

It would not be hard to set up a block form (I’d prefer to delimit it with %%) which would be passed to a div rather than a span. The typesetting itself, though, would be unaffected because asciimath itself does not distinguish between inline and display math. That’s why I didn’t specify a block form to begin with and I’m still not totally sure if it’s a good idea.

I don’t believe that math.stackexchange uses asciimath and I’m fairly active there. I honestly don’t know just how widely used it is. My own interest arises because I use Discourse to set up fora for college students and I’d like something that’s a bit more intuitive for them to use. I think the fact that asciimath is, to some degree, a “simpler” LaTeX supports the idea to use a single delimiter as well.

1 Like

Ok so I am fine to accept % but let’s make this optional default off with a site setting


I can definitely do that!