diff --git a/readme_renderer/rst.py b/readme_renderer/rst.py index cadd843..fdc4e82 100644 --- a/readme_renderer/rst.py +++ b/readme_renderer/rst.py @@ -76,7 +76,8 @@ def emptytag( # Output math blocks as LaTeX that can be interpreted by MathJax for # a prettier display of Math formulas. - "math_output": "MathJax", + # Pass a dummy path to supress docutils warning and emit HTML. + "math_output": "MathJax /dummy.js", # Disable raw html as enabling it is a security risk, we do not want # people to be able to include any old HTML in the final output. diff --git a/tests/fixtures/test_rst_math.html b/tests/fixtures/test_rst_math.html new file mode 100644 index 0000000..763c958 --- /dev/null +++ b/tests/fixtures/test_rst_math.html @@ -0,0 +1,8 @@ +

A math directive:

+
+\begin{equation*} +\alpha _t(i) = P(O_1, O_2, \ldots O_t, q_t = S_i \lambda ) +\end{equation*} +
+

A :math: role:

+

The area of a circle is \(A_\text{c} = (\pi/4) d^2\).

diff --git a/tests/fixtures/test_rst_math.rst b/tests/fixtures/test_rst_math.rst new file mode 100644 index 0000000..b4e6db7 --- /dev/null +++ b/tests/fixtures/test_rst_math.rst @@ -0,0 +1,14 @@ +.. Sample from https://docutils.sourceforge.io/docs/ref/rst/directives.html#math + +A ``math`` directive: + +.. math:: + + α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ) + + +.. Sample from https://docutils.sourceforge.io/docs/ref/rst/roles.html#math + +A ``:math:`` role: + +The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`.