mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 16:06:12 +08:00
This upgrades to Mathjax 4.1 and latest katex Implement rich text composer support for math Adds support for /( )/ and /[ /] which was missing and very common now Removes math javascript from our repo --------- Co-authored-by: Mark McClure <mcmcclur@unca.edu>
19 lines
575 B
JavaScript
Vendored
19 lines
575 B
JavaScript
Vendored
import {
|
|
getMathJax,
|
|
loadOutput,
|
|
} from "discourse/plugins/discourse-math/lib/mathjax-bundle";
|
|
|
|
// MathJax can only be initialized once per page load with a single output format.
|
|
// The output format is locked to whichever value is passed on the first call.
|
|
let outputPromise;
|
|
|
|
export default async function loadMathJax(options = {}) {
|
|
const output = options.output === "svg" ? "svg" : "html";
|
|
if (!outputPromise) {
|
|
outputPromise = loadOutput(output);
|
|
}
|
|
await outputPromise;
|
|
|
|
await window.MathJax.startup.promise;
|
|
return getMathJax() ?? window.MathJax;
|
|
}
|