Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line <math> statements in a * list break with MediaWiki -> HTML #9293

Closed
FrederickGeek8 opened this issue Dec 31, 2023 · 0 comments
Closed
Labels

Comments

@FrederickGeek8
Copy link

Explain the problem.

I was trying to convert some MediaWiki code taken from Wikipedia into HTML. It appears that some of the code that page uses the <math> tag across multiple lines inside of a * list, which breaks the generated HTML. Putting the same <math>...</math> statement onto the same line as the * fixes the issue.

* Linearity in the first argument:
*:<math>\begin{align}
\langle a \mathbf u, \mathbf v\rangle &= a \langle \mathbf u, \mathbf v\rangle. \\
\langle \mathbf u + \mathbf v, \mathbf w\rangle &= \langle \mathbf u, \mathbf w\rangle+ \langle \mathbf v, \mathbf w\rangle.
\end{align}</math>

* Correction
*:<math>\begin{align} \langle a \mathbf u, \mathbf v\rangle &= a \langle \mathbf u, \mathbf v\rangle. \\ \langle \mathbf u + \mathbf v, \mathbf w\rangle &= \langle \mathbf u, \mathbf w\rangle+ \langle \mathbf v, \mathbf w\rangle. \end{align}</math>

* It is not limited to display math:
*:<math>a^2 + b^2
= c^2</math>

* One-line version:
*:<math>a^2 + b^2 = c^2</math>

gets rendered as

Screenshot of incorrectly rendered Math displayed in Firefox

with the generated HTML being

<ul>
<li>Linearity in the first argument:
<p>:<math>\begin{align}</p></li>
</ul>
<p>\langle a \mathbf u, \mathbf v\rangle &amp;= a \langle \mathbf u,
\mathbf v\rangle. \\ \langle \mathbf u + \mathbf v, \mathbf w\rangle
&amp;= \langle \mathbf u, \mathbf w\rangle+ \langle \mathbf v, \mathbf
w\rangle. \end{align}</math></p>
<ul>
<li>Correction
<p><span class="math display">\[\begin{align} \langle a \mathbf u,
\mathbf v\rangle &amp;= a \langle \mathbf u, \mathbf v\rangle. \\
\langle \mathbf u + \mathbf v, \mathbf w\rangle &amp;= \langle \mathbf
u, \mathbf w\rangle+ \langle \mathbf v, \mathbf w\rangle.
\end{align}\]</span></p></li>
</ul>
<ul>
<li>It is not limited to display math:
<p>:<math>a^2 + b^2</p></li>
</ul>
<p>= c^2</math></p>
<ul>
<li>One-line version:
<p><span class="math display">\[a^2 + b^2 = c^2\]</span></p></li>
</ul>

Command used

pandoc -f mediawiki -t html5 --mathjax --standalone -o test3.html minimalbreak.wikitext

Given the generated HTML, it appears that this breakage is in the conversion from MediaWiki text -> HTML and is not isolated to MathJax (other Math renderers give the same result).

Pandoc version?
What version of pandoc are you using, on what OS? (If it's not the latest release, please try with the latest release before reporting the issue.)
I am using pandoc version 3.1.11 on macOS 14.2.1 installed via homebrew.

$ pandoc --version
pandoc 3.1.11
Features: +server +lua
Scripting engine: Lua 5.4

Thank you all for your help and contributions to this project!

@jgm jgm closed this as completed in 9a8f27b Dec 31, 2023
jgm added a commit that referenced this issue Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant