<link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markdown-it-texmath/css/texmath.min.css">
<link rel="stylesheet" href="/static/monokai.css">
<script src="/static/math.js">
</script>
<script src="/static/highlight.js"></script> 
<script src="/static/parser.js"></script>
<script>
  window.parser = window.markdownit({
      {# The lower is needed to make JS understand Python bools #}
      {% for name, value in config.EDITOR_CONF.settings.items() %}
        {{ name }}: {{ value | lower }},
      {% endfor %}
      highlight: function (str, lang) {
        if (lang && hljs.getLanguage(lang)) {
          try {
            return '<pre class="hljs"><code>' +
                    hljs.highlight(lang, str, true).value +
                    '</code></pre>';
          } catch (__) {}
        }
      }
  })
  .use(texmath.use(katex), {
    engine: katex,
    delimiters:'dollars',
    katexOptions: { macros: {"\\RR": "\\mathbb{R}"} }
  })
  {% for plugin_name, plugin_params in config.EDITOR_CONF.plugins.items() %}
    .use(window.{{plugin_name}}{% if plugin_params | length %}, {{plugin_params|tojson}}{% endif %})
  {% endfor %}
</script>
