• hi,

    thank you for the plugin, I really like it. But I’m planning to write chemical equations, so I need mhchem extension.

    I’d like to keep all the scripts locally, so this is what I did: I downloaded mhchem.min.js to katex-0.12.0 folder and changed resource.php file: I registered the script:

    	wp_register_script(
                'mhchem',
                KATEX__PLUGIN_URL . 'assets/katex-' . KATEX_JS_VERSION . '/mhchem.min.js',
                array(), // No dependencies.
                false, // No versioning.
                true // In footer.
            );

    then added the line:
    wp_enqueue_script('mhchem');

    It seems to be working mostly although some formulas aren’t working, e.g. \ce{A\bond{-}B\bond{=}C\bond{#}D}

    Maybe there is some better way to do it? I’m not a wordpress coder.

    Besides, if I decide to use cdn, is there any easy way to change the code to use jsDelivr CDN?

    Thank you.

Viewing 1 replies (of 1 total)
  • Plugin Author Thomas Churchman

    (@beskhue)

    Yes, this would be the way to do it.

    To use jsDelivr this works:

    	wp_register_script(
                'mhchem',
                '//cdn.jsdelivr.net/npm/katex@' . KATEX_JS_VERSION . '/dist/contrib/mhchem.min.js',
                array(), // No dependencies.
                false, // No versioning.
                true // In footer.
            );
    

    I’m not sure why those formulas do not work. Are you using them inside a KaTeX block?

Viewing 1 replies (of 1 total)
  • The topic ‘KaTeX plugin and mhchem’ is closed to new replies.