git.iko.soy/typeable/pandoc
on master help sign in
Use revealjs's math plugin for mathjax.
ec3992bJohn MacFarlane
data/templates/default.revealjs+11−2
@@ -229,15 +229,24 @@ $endif$
229$if(maxScale)$
229$if(maxScale)$
230 maxScale: $maxScale$,
230 maxScale: $maxScale$,
231$endif$
231$endif$
232+$if(mathjax)$
233+ math: {
234+ mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
235+ config: 'TeX-AMS_HTML-full',
236+ },
237+$endif$
232
238
233 // Optional reveal.js plugins
239 // Optional reveal.js plugins
234 dependencies: [
240 dependencies: [
235 { src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
241 { src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
236 { src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true },
242 { src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true },
237− $if(notes-server)$
243+$if(notes-server)$
238 { src: '$revealjs-url$/socket.io/socker.io.js', async: true },
244 { src: '$revealjs-url$/socket.io/socker.io.js', async: true },
239 { src: '$revealjs-url$/plugin/notes-server/client.js', async: true },
245 { src: '$revealjs-url$/plugin/notes-server/client.js', async: true },
240− $endif$
246+$endif$
247+$if(mathjax)$
248+ { src: '$revealjs-url$/plugin/math/math.js', async: true },
249+$endif$
241 { src: '$revealjs-url$/plugin/notes/notes.js', async: true }
250 { src: '$revealjs-url$/plugin/notes/notes.js', async: true }
242 ]
251 ]
243 });
252 });
src/Text/Pandoc/Writers/HTML.hs+7−1
@@ -253,7 +253,9 @@ pandocToHtml opts (Pandoc meta blocks) = do
253 H.script ! A.src (toValue url)
253 H.script ! A.src (toValue url)
254 ! A.type_ "text/javascript"
254 ! A.type_ "text/javascript"
255 $ mempty
255 $ mempty
256− MathJax url ->
256+ MathJax url
257+ | slideVariant /= RevealJsSlides ->
258+ -- mathjax is handled via a special plugin in revealjs
257 H.script ! A.src (toValue url)
259 H.script ! A.src (toValue url)
258 ! A.type_ "text/javascript"
260 ! A.type_ "text/javascript"
259 $ case slideVariant of
261 $ case slideVariant of
@@ -285,6 +287,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
285 (if stMath st
287 (if stMath st
286 then defField "math" (renderHtml' math)
288 then defField "math" (renderHtml' math)
287 else id) $
289 else id) $
290+ defField "mathjax"
291+ (case writerHTMLMathMethod opts of
292+ MathJax _ -> True
293+ _ -> False) $
288 defField "quotes" (stQuotes st) $
294 defField "quotes" (stQuotes st) $
289 maybe id (defField "toc" . renderHtml') toc $
295 maybe id (defField "toc" . renderHtml') toc $
290 defField "author-meta" authsMeta $
296 defField "author-meta" authsMeta $