Parsing AsciiMath #9
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As StrapDown.js is using MathJax that can parse natively AsciiMath is there an easy way to render AsciiMath notation formulas in StrapDown.js?
Hi @sebi5361.
I never heard of AsciiMath. Thanks for asking.
From what I see about AsciiMath, the delimiter has to be ` ie backticks, but that's already used by StrapDown.js's MarkDown parser, which renders MarkDown to HTML before latting MathJax render maths equations.
In this example file (might take a while to be updated, it's using GitHub pages which is not instantaneous, see this page for a preview from my website), I tried to write a couple of equations in AsciiMath syntax like
\Delta = b^2-4ac
but it is rendered as code (code
<-- like here in this comment), not Math.Apparently one can change the delimiters of AsciiMath to
...
instead of backticks. (from the MathJax documentation)I'll try this.
I updated my example, by adding the suggested configuration line
and trying to write math using AsciiMath notation between
dollars
or `backticks`, but both of them do not work.Sorry, I don't know what to try more.
I guess making AsciiMath work with StrapDown.js would take too much effort as this straightaway approach failed...
Too bad )-:
Thanks anyway
Yes sorry I don't know what else to try.
But honestly, from what I just read about AsciiMath, I don't see the advantages it could have over plain LaTeX.
I understand your argument as you are familiar with Latex, but as I don't have a lot of experience with it I am seduced by the much cleaner syntax of AsciiMath.
Maybe mixed delimiters could do the job if parsed in a right order?
This notation is used in some advanced Markdown + mathematical markup language parsers:
or:
Maybe it can give us some hints...
Oh smart. Escaping backticks works, for inline AsciiMath only!

See this example.
All the other things I tried fails (dollar signs for inline, double dollars for display, three backticks or escaped backticks with AsciiMath code block, etc)
I also added your four examples, which can fail if the _ are not escaped with a backslash: same issue as using LaTeX with MathJax, as the Markdown parser converts to HTML before loading MathJax, it interprets
_ text surrounded by underscores _
as italic!It's great to have inline equations already!
I really have no clue how the parser(s) work(s), but maybe we could try some nested Markdown code blocks similar to
`` ` ``
that displays`
once rendered: