Search code examples
rubyjekyllkramdownkatex

Jekyll kramdown math render settings


I recently updated to Jekyll 4.0.1 I have made plugin which detects and render latex expressions to html using katex. But now Jekyll's kramdown renders latex expressions differently.

In old jekyll would render $$ 1 + 1 = 2$$ like this:

<script type="math\/tex; mode=display">1 + 1 = 2<\/script>

now it is rendered as:

/[ 1 + 1 = 2 /]

How can I set kramdown to render the old way ?

Thank you for help


Solution

  • Solution is to set math engine to katex


    First you need to install katex gem:

    sudo gem install kramdown-math-katex
    

    and then add kramdown option to jekyll config file:

    kramdown:
        math-engine: katex