Closed tomtung closed 4 years ago
You are right at a first glance, but ...
code blocks and tables are intrinsic markdown elements and recognized per se as block elements by the markdown parser (here markdown-it).
$$
is a custom element and treated as inline text by default (simple linebreaks are ignored as you might know). So in order
we need an empty line before block formulas signalling the beginning of a new paragraph to the parser.
This is in fact somewhat inconsistent compared to intrinsic block elements. I am simply not aware of a working consistent solution. If you might be, please tell me.
Thanks
@goessner Hello !
Sorry for this little "necromancy"... but I would like to adapt markdown-it-texmath used on my nodebb forum to have display mode working also without an empty line before the starting $$...
You say that
$$ is a custom element and treated as inline text by default (simple linebreaks are ignored as you might know)
but, in the markdown plugin in nodebb, there is an option to "Treat newlines as single line breaks" and it works...
Can you give me some guidelines to adapt your texmath.js ? For example, the string processed by applyRule contains "text\n$$formula$$" and it should give text followed by the formula in display mode. I tried things but without success (markdown-it background is obscure for me but I have time to work on it with the... covid-19 :-/ )...
Latex blocks only work when they are preceded by an empty line. This behavior is not consistent with other blocks (e.g. code, table, etc.).
For example, the first math block in the following Markdown document won't render:
Math block doesn't work: $$\frac{1}{2}$$
Unless an empty line precedes it:
$$\frac{1}{2}$$