From 36827ddafeaa7a683362eb8da31065aaff9676d5 Mon Sep 17 00:00:00 2001 From: Shuai Lin Date: Tue, 2 Aug 2016 09:14:08 -0700 Subject: [SPARK-16822][DOC] Support latex in scaladoc. ## What changes were proposed in this pull request? Support using latex in scaladoc by adding MathJax javascript to the js template. ## How was this patch tested? Generated scaladoc. Preview: - LogisticGradient: [before](https://spark.apache.org/docs/2.0.0/api/scala/index.html#org.apache.spark.mllib.optimization.LogisticGradient) and [after](https://sparkdocs.lins05.pw/spark-16822/api/scala/index.html#org.apache.spark.mllib.optimization.LogisticGradient) - MinMaxScaler: [before](https://spark.apache.org/docs/2.0.0/api/scala/index.html#org.apache.spark.ml.feature.MinMaxScaler) and [after](https://sparkdocs.lins05.pw/spark-16822/api/scala/index.html#org.apache.spark.ml.feature.MinMaxScaler) Author: Shuai Lin Closes #14438 from lins05/spark-16822-support-latex-in-scaladoc. --- docs/js/api-docs.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'docs') diff --git a/docs/js/api-docs.js b/docs/js/api-docs.js index ce89d8943b..96c63cc127 100644 --- a/docs/js/api-docs.js +++ b/docs/js/api-docs.js @@ -41,3 +41,23 @@ function addBadges(allAnnotations, name, tag, html) { .add(annotations.closest("div.fullcomment").prevAll("h4.signature")) .prepend(html); } + +$(document).ready(function() { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.async = true; + script.onload = function(){ + MathJax.Hub.Config({ + displayAlign: "left", + tex2jax: { + inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ], + displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], + processEscapes: true, + skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'a'] + } + }); + }; + script.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + + 'cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; + document.getElementsByTagName('head')[0].appendChild(script); +}); -- cgit v1.2.3