Make mathml the default math-method.

Closes #11751.
This commit is contained in:
John MacFarlane
2026-08-21 22:11:30 -07:00
parent c73a35a2e7
commit 9260d17d21
12 changed files with 48 additions and 53 deletions
+1 -1
View File
@@ -1669,7 +1669,7 @@ header when requesting a document from a URL:
: Specify the method used to display TeX math. The following
methods are possible (some take an optional URL, separated
from the method name by a colon). The default value is `plain`.
from the method name by a colon). The default value is `mathml`.
`plain`
+2 -2
View File
@@ -46,7 +46,7 @@ import Text.Pandoc.Filter (Filter (..))
import Text.Pandoc.Logging (Verbosity (WARNING), LogMessage(..))
import Text.Pandoc.Options (TopLevelDivision (TopLevelDefault),
TrackChanges (AcceptChanges),
WrapOption (WrapAuto), MathMethod (PlainMath),
WrapOption (WrapAuto), MathMethod (MathML),
ReferenceLocation (EndOfDocument),
CaptionPosition (..),
ObfuscationMethod (NoObfuscation),
@@ -853,7 +853,7 @@ defaultOpts = Opt
, optSyntaxDefinitions = []
, optSyntaxHighlighting = DefaultHighlightingString
, optTopLevelDivision = TopLevelDefault
, optMathMethod = PlainMath
, optMathMethod = MathML
, optAbbreviations = Nothing
, optReferenceDoc = Nothing
, optSplitLevel = 1
+1 -1
View File
@@ -402,7 +402,7 @@ instance Default WriterOptions where
, writerListOfFigures = False
, writerListOfTables = False
, writerIncremental = False
, writerMathMethod = PlainMath
, writerMathMethod = MathML
, writerNumberSections = False
, writerNumberOffset = [0,0,0,0,0,0]
, writerSectionDivs = False
+2 -1
View File
@@ -3,6 +3,7 @@
\newcommand{\a}{\ifmmode x \else y \fi}
$\a$ and \a
^D
<p><span class="math inline"><em>x</em></span> and y</p>
<p><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math>
and y</p>
```
+4 -2
View File
@@ -33,8 +33,10 @@
<tr>
<td style="text-align: right;">160</td>
<td style="text-align: right;">2</td>
<td colspan="2" style="text-align: left;"><em>This is a test:</em> <span
class="math display"><em>a</em><sup>2</sup>+<em>b</em><sup>2</sup>=<em>c</em><sup>2</sup></span></td>
<td colspan="2" style="text-align: left;"><em>This is a test:</em>
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup><mo>=</mo><msup><mi>c</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">\begin{equation*}
a^2+b^2 = c^2
\end{equation*}</annotation></semantics></math></td>
</tr>
</tbody>
</table>
+1 -3
View File
@@ -31,7 +31,6 @@
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
@@ -70,8 +69,7 @@
<div id="math" class="slide section level1">
<h1>Math</h1>
<ul>
<li><span class="math inline">$\frac{d}{dx}f(x)=\lim_{h\to
0}\frac{f(x+h)-f(x)}{h}$</span></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo><mo>=</mo><msub><mrow><mi mathvariant="normal">lim</mi><mo>&#8289;</mo></mrow><mrow><mi>h</mi><mo></mo><mn>0</mn></mrow></msub><mfrac><mrow><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo>+</mo><mi>h</mi><mo stretchy="false" form="postfix">)</mo><mo></mo><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mrow><mi>h</mi></mfrac></mrow><annotation encoding="application/x-tex">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</annotation></semantics></math></li>
</ul>
</div>
</div>
+1 -2
View File
@@ -5,6 +5,5 @@
</ul>
<h1 id="math">Math</h1>
<ul>
<li><span class="math inline">$\frac{d}{dx}f(x)=\lim_{h\to
0}\frac{f(x+h)-f(x)}{h}$</span></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo><mo>=</mo><msub><mrow><mi mathvariant="normal">lim</mi><mo>&#8289;</mo></mrow><mrow><mi>h</mi><mo></mo><mn>0</mn></mrow></msub><mfrac><mrow><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo>+</mo><mi>h</mi><mo stretchy="false" form="postfix">)</mo><mo></mo><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mrow><mi>h</mi></mfrac></mrow><annotation encoding="application/x-tex">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</annotation></semantics></math></li>
</ul>
+1 -3
View File
@@ -29,7 +29,6 @@
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<link rel="stylesheet" href="main.css" type="text/css" />
STUFF INSERTED
@@ -49,8 +48,7 @@ STUFF INSERTED
</ul>
<h1 id="math">Math</h1>
<ul>
<li><span class="math inline">$\frac{d}{dx}f(x)=\lim_{h\to
0}\frac{f(x+h)-f(x)}{h}$</span></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo><mo>=</mo><msub><mrow><mi mathvariant="normal">lim</mi><mo>&#8289;</mo></mrow><mrow><mi>h</mi><mo></mo><mn>0</mn></mrow></msub><mfrac><mrow><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo>+</mo><mi>h</mi><mo stretchy="false" form="postfix">)</mo><mo></mo><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mrow><mi>h</mi></mfrac></mrow><annotation encoding="application/x-tex">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</annotation></semantics></math></li>
</ul>
STUFF INSERTED
</body>
+9 -9
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook EBNF Module V1.1CR1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<article>
<articleinfo>
<title>Pandoc Test Suite</title>
@@ -1052,39 +1052,39 @@ These should not be escaped: \$ \\ \&gt; \[ \{
</listitem>
<listitem>
<para>
2+2=4
<inlineequation><mml:math><mml:mrow><mml:mn>2</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn><mml:mo>=</mml:mo><mml:mn>4</mml:mn></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>x</emphasis> ∈ <emphasis>y</emphasis>
<inlineequation><mml:math><mml:mrow><mml:mi>x</mml:mi><mml:mo>∈</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>α</emphasis> ∧ <emphasis>ω</emphasis>
<inlineequation><mml:math><mml:mrow><mml:mi>α</mml:mi><mml:mo>∧</mml:mo><mml:mi>ω</mml:mi></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
223
<inlineequation><mml:math><mml:mn>223</mml:mn></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>p</emphasis>-Tree
<inlineequation><mml:math><mml:mi>p</mml:mi></mml:math></inlineequation>-Tree
</para>
</listitem>
<listitem>
<para>
Heres some display math:
$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
<informalequation><mml:math><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi mml:mathvariant="normal">lim</mml:mi><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo><mml:mo></mml:mo><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></informalequation>
</para>
</listitem>
<listitem>
<para>
Heres one that has a line break in it:
<emphasis>α</emphasis>+<emphasis>ω</emphasis> × <emphasis>x</emphasis><superscript>2</superscript>.
<inlineequation><mml:math><mml:mrow><mml:mi>α</mml:mi><mml:mo>+</mml:mo><mml:mi>ω</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:math></inlineequation>.
</para>
</listitem>
</itemizedlist>
+8 -7
View File
@@ -2,6 +2,7 @@
<!DOCTYPE article>
<article
xmlns="http://docbook.org/ns/docbook" version="5.0"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xlink="http://www.w3.org/1999/xlink" >
<info>
<title>Pandoc Test Suite</title>
@@ -1027,39 +1028,39 @@ These should not be escaped: \$ \\ \&gt; \[ \{
</listitem>
<listitem>
<para>
2+2=4
<inlineequation><mml:math><mml:mrow><mml:mn>2</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn><mml:mo>=</mml:mo><mml:mn>4</mml:mn></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>x</emphasis> ∈ <emphasis>y</emphasis>
<inlineequation><mml:math><mml:mrow><mml:mi>x</mml:mi><mml:mo>∈</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>α</emphasis> ∧ <emphasis>ω</emphasis>
<inlineequation><mml:math><mml:mrow><mml:mi>α</mml:mi><mml:mo>∧</mml:mo><mml:mi>ω</mml:mi></mml:mrow></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
223
<inlineequation><mml:math><mml:mn>223</mml:mn></mml:math></inlineequation>
</para>
</listitem>
<listitem>
<para>
<emphasis>p</emphasis>-Tree
<inlineequation><mml:math><mml:mi>p</mml:mi></mml:math></inlineequation>-Tree
</para>
</listitem>
<listitem>
<para>
Heres some display math:
$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
<informalequation><mml:math><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi mml:mathvariant="normal">lim</mml:mi><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo><mml:mo></mml:mo><mml:mi>f</mml:mi><mml:mo mml:stretchy="false" mml:form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo mml:stretchy="false" mml:form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></informalequation>
</para>
</listitem>
<listitem>
<para>
Heres one that has a line break in it:
<emphasis>α</emphasis>+<emphasis>ω</emphasis> × <emphasis>x</emphasis><superscript>2</superscript>.
<inlineequation><mml:math><mml:mrow><mml:mi>α</mml:mi><mml:mo>+</mml:mo><mml:mi>ω</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:math></inlineequation>.
</para>
</listitem>
</itemizedlist>
+9 -11
View File
@@ -174,7 +174,6 @@
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
</head>
<body>
@@ -618,16 +617,15 @@ href="http://example.com/?foo=1&amp;bar=2">quoted link</a>”.</p>
<h1 id="latex">LaTeX</h1>
<ul>
<li></li>
<li><span class="math inline">2+2=4</span></li>
<li><span class="math inline"><em>x</em> ∈ <em>y</em></span></li>
<li><span class="math inline"><em>α</em> ∧ <em>ω</em></span></li>
<li><span class="math inline">223</span></li>
<li><span class="math inline"><em>p</em></span>-Tree</li>
<li>Heres some display math: <span
class="math display">$$\frac{d}{dx}f(x)=\lim_{h\to
0}\frac{f(x+h)-f(x)}{h}$$</span></li>
<li>Heres one that has a line break in it: <span
class="math inline"><em>α</em>+<em>ω</em> × <em>x</em><sup>2</sup></span>.</li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>+</mo><mn>2</mn><mo>=</mo><mn>4</mn></mrow><annotation encoding="application/x-tex">2+2=4</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi><mo>∈</mo><mi>y</mi></mrow><annotation encoding="application/x-tex">x \in y</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>α</mi><mo>∧</mo><mi>ω</mi></mrow><annotation encoding="application/x-tex">\alpha \wedge \omega</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mn>223</mn><annotation encoding="application/x-tex">223</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>p</mi><annotation encoding="application/x-tex">p</annotation></semantics></math>-Tree</li>
<li>Heres some display math:
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo><mo>=</mo><munder><mi mathvariant="normal">lim</mi><mrow><mi>h</mi><mo>→</mo><mn>0</mn></mrow></munder><mfrac><mrow><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo>+</mo><mi>h</mi><mo stretchy="false" form="postfix">)</mo><mo></mo><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mrow><mi>h</mi></mfrac></mrow><annotation encoding="application/x-tex">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</annotation></semantics></math></li>
<li>Heres one that has a line break in it:
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>α</mi><mo>+</mo><mi>ω</mi><mo>×</mo><msup><mi>x</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">\alpha + \omega \times x^2</annotation></semantics></math>.</li>
</ul>
<p>These shouldnt be math:</p>
<ul>
+9 -11
View File
@@ -174,7 +174,6 @@
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
</head>
<body>
@@ -618,16 +617,15 @@ href="http://example.com/?foo=1&amp;bar=2">quoted link</a>”.</p>
<h1 id="latex">LaTeX</h1>
<ul>
<li></li>
<li><span class="math inline">2+2=4</span></li>
<li><span class="math inline"><em>x</em> ∈ <em>y</em></span></li>
<li><span class="math inline"><em>α</em> ∧ <em>ω</em></span></li>
<li><span class="math inline">223</span></li>
<li><span class="math inline"><em>p</em></span>-Tree</li>
<li>Heres some display math: <span
class="math display">$$\frac{d}{dx}f(x)=\lim_{h\to
0}\frac{f(x+h)-f(x)}{h}$$</span></li>
<li>Heres one that has a line break in it: <span
class="math inline"><em>α</em>+<em>ω</em> × <em>x</em><sup>2</sup></span>.</li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>+</mo><mn>2</mn><mo>=</mo><mn>4</mn></mrow><annotation encoding="application/x-tex">2+2=4</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi><mo>∈</mo><mi>y</mi></mrow><annotation encoding="application/x-tex">x \in y</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>α</mi><mo>∧</mo><mi>ω</mi></mrow><annotation encoding="application/x-tex">\alpha \wedge \omega</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mn>223</mn><annotation encoding="application/x-tex">223</annotation></semantics></math></li>
<li><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>p</mi><annotation encoding="application/x-tex">p</annotation></semantics></math>-Tree</li>
<li>Heres some display math:
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo><mo>=</mo><munder><mi mathvariant="normal">lim</mi><mrow><mi>h</mi><mo>→</mo><mn>0</mn></mrow></munder><mfrac><mrow><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo>+</mo><mi>h</mi><mo stretchy="false" form="postfix">)</mo><mo></mo><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mrow><mi>h</mi></mfrac></mrow><annotation encoding="application/x-tex">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</annotation></semantics></math></li>
<li>Heres one that has a line break in it:
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>α</mi><mo>+</mo><mi>ω</mi><mo>×</mo><msup><mi>x</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">\alpha + \omega \times x^2</annotation></semantics></math>.</li>
</ul>
<p>These shouldnt be math:</p>
<ul>