2

Is there a way to add mathjax support to ikiwiki? If so, how to proceed step by step (in linux) to get this?

Helgi
  • 5,428
  • 1
  • 31
  • 48
student
  • 1,636
  • 3
  • 29
  • 53

1 Answers1

3
  • Install pandoc (> 1.8)
  • Get the latest pandoc-iki plugin: cd /tmp/; git clone https://github.com/dubiousjim/pandoc-iki.git
  • find out where pandoc is installed: which pandoc for example /usr/bin/pandoc
  • add the following lines to your wiki - setup (e.g. mywiki.setup) file:

    # pandoc plugin
    
    pandoc_command => "/usr/bin/pandoc",
    
    pandoc_latex => 1,
    
    pandoc_rst => 0,
    
    pandoc_math => "mathjax",
    
  • add pandoc to your plugin list in your setup file, for example

     \# plugins to add to the default configuration
    
    add_plugins => [qw{goodstuff websetup wmd pandoc}]
    
  • sudo cp /tmp/pandoc-iki/mathjax.tmpl /usr/share/ikiwiki/templates/page.tmpl
  • sudo cp /tmp/pandoc-iki/pandoc.pm /usr/share/perl5/IkiWiki/Plugin
  • sudo ikiwiki --setup ~/mywiki.setup

  • To activate html_css you change the following line in /usr/share/ikiwiki/templates/page.tmpl:

    <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

    to

    <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full" type="text/javascript"></script>

    then do sudo ikiwiki --setup ~/mywiki.setup again.

  • If you want to use your ikiwiki offline too, you could change the path to the directory: download mathjax and put it somewhere for example into /var/www/myiki and do in change the line above to

    <script src="/iki/mathjax/MathJax.js?config=TeX-AMS_HTML-full"   type="text/javascript"></script>
    

    (don't forget to run ikiwiki --setup)

student
  • 1,636
  • 3
  • 29
  • 53
  • Note from the future: cdn.mathjax.org is nearing its end-of-life, check https://www.mathjax.org/cdn-shutting-down for migration tips (and perhaps update your post for future readers). – Peter Krautzberger Apr 21 '17 at 07:48