HTML writer: render raw inline environments when --mathjax used.

We previously did this only with raw blocks, on the assumption
that math environments would always be raw blocks. This has changed
since we now parse them as inline environments.

Closes #3816.
This commit is contained in:
John MacFarlane 2017-07-26 12:50:36 +02:00
parent 2daab579f4
commit e0ab09611a
2 changed files with 37 additions and 3 deletions

View file

@ -1007,9 +1007,14 @@ inlineToHtml opts inline = do
ishtml <- isRawHtml f
if ishtml
then return $ preEscapedString str
else do
report $ InlineNotRendered inline
return mempty
else if (f == Format "latex" || f == Format "tex") &&
"\\begin" `isPrefixOf` str &&
allowsMathEnvironments (writerHTMLMathMethod opts) &&
isMathEnvironment str
then inlineToHtml opts $ Math DisplayMath str
else do
report $ InlineNotRendered inline
return mempty
(Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
linkText <- inlineListToHtml opts txt
obfuscateLink opts attr linkText s

29
test/command/3816.md Normal file
View file

@ -0,0 +1,29 @@
```
% pandoc --mathjax -t html5
This is an equation:
\begin{equation}
y+2 = 3
\end{equation}
This is a system of equations:
\begin{align*}
x^2+y^2 & = 2 \\
\sin(y) & = 0.5
\end{align*}
This is Euler's formula:
\begin{eqnarray*}
e^{i\pi} + 1 & = & 0.
\end{eqnarray*}
^D
<p>This is an equation: <span class="math display">\[\begin{equation}
y+2 = 3
\end{equation}\]</span></p>
<p>This is a system of equations: <span class="math display">\[\begin{align*}
x^2+y^2 &amp; = 2 \\
\sin(y) &amp; = 0.5
\end{align*}\]</span></p>
<p>This is Eulers formula: <span class="math display">\[\begin{eqnarray*}
e^{i\pi} + 1 &amp; = &amp; 0.
\end{eqnarray*}\]</span></p>
```