http://haml.info/docs/yardoc/file.REFERENCE.html#javascript-filter
HAML:
%script{:type => "text/javascript",
:src => "javascripts/script_#{2 + 7}"}
MathJax
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$']],
processEscapes: true
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
Git Diff
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 375f886..773c440 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -34,7 +34,7 @@ module GitlabMarkdownHelper
# see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
filter_html: true,
with_toc_data: true,
- hard_wrap: true)
+ hard_wrap: false)
@markdown = Redcarpet::Markdown.new(gitlab_renderer,
# see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
no_intra_emphasis: true,
@@ -44,7 +44,7 @@ module GitlabMarkdownHelper
strikethrough: true,
lax_html_blocks: true,
space_after_headers: true,
- superscript: true)
+ superscript: false)
end
@markdown.render(text).html_safe
diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml
index b237bc5..368c21d 100644
--- a/app/views/wikis/show.html.haml
+++ b/app/views/wikis/show.html.haml
@@ -1,4 +1,11 @@
= render 'wikis/nav'
+
+%script{:type => "text/javascript",
+ :src => "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"}
+
+%script{:type => "text/javascript",
+ :src => "/mathjax_config.js"}
+
%h3.page_title
= @wiki.title.titleize
= render partial: 'main_links'
diff --git a/public/mathjax_config.js b/public/mathjax_config.js
new file mode 100644
index 0000000..40bee60
--- /dev/null
+++ b/public/mathjax_config.js
@@ -0,0 +1,12 @@
+MathJax.Hub.Config({
+tex2jax: {
+inlineMath: [['$','$']],
+processEscapes: true
+}
+});
+
+$(document).ready(function(){
+ $('.file_content.wiki').map(function(){
+ MathJax.Hub.Queue(["Typeset",MathJax.Hub,$(this).get(0)]);
+ });
+});
Path:
app/views/wikis/show.html.haml
This was a modification for GL 5.x back in July 2013. We are using newer version now. The diff here is not meant to be a copy-and-paste solution. It was done in a two-hour pair hack and none of us are ruby/JS/HTML professional. Just a hint for users to enable Mathjax in GL's wiki.