Ability to customize init config for MathJax in Discourse Math plugin

There are some predefined configuration for MathJax in discourse/plugins/discourse-math/assets/javascripts/lib/math-renderer.js at main · discourse/discourse but there are only a few settings available to modify this config. What about adding a setting for additional config JSON, which merges with predefined config and allows for more fine-grained configuration of MathJax?

Our use case is to customize loader path configuration with an alternate CDN. Currently this can only be achieved by patching the plugin code, which is not recommended and makes deployment more complex.

See also Feature Request: Support for \nicefrac in Discourse Math (\KaTeX/\MathJax) - Feature - Discourse Meta. If custom configuration is supported, it can be simply supported by setting the following additional config from admin UI:

{
  loader: {load: ['[tex]/units']},
  tex: {packages: {'[+]': ['units']}}
}
2 Likes