aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorShuai Lin <linshuai2012@gmail.com>2016-08-02 09:14:08 -0700
committerSean Owen <sowen@cloudera.com>2016-08-02 09:14:08 -0700
commit36827ddafeaa7a683362eb8da31065aaff9676d5 (patch)
tree87ff13f11c8c858996a5a85e11c0022de9b1104b /docs
parent511dede1118f20a7756f614acb6fc88af52c9de9 (diff)
downloadspark-36827ddafeaa7a683362eb8da31065aaff9676d5.tar.gz
spark-36827ddafeaa7a683362eb8da31065aaff9676d5.tar.bz2
spark-36827ddafeaa7a683362eb8da31065aaff9676d5.zip
[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 <linshuai2012@gmail.com> Closes #14438 from lins05/spark-16822-support-latex-in-scaladoc.
Diffstat (limited to 'docs')
-rw-r--r--docs/js/api-docs.js20
1 files changed, 20 insertions, 0 deletions
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);
+});