mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 22:36:11 +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>
22 lines
669 B
JavaScript
Vendored
22 lines
669 B
JavaScript
Vendored
import { getURLWithCDN } from "discourse/lib/get-url";
|
|
import loadScript from "discourse/lib/load-script";
|
|
import { getMathJaxBasePath } from "discourse/plugins/discourse-math/lib/math-bundle-paths";
|
|
|
|
function getBasePath() {
|
|
return getMathJaxBasePath();
|
|
}
|
|
|
|
// Output format is locked to the first call - MathJax can only be initialized once.
|
|
let outputPromise;
|
|
|
|
export function loadOutput(output) {
|
|
if (!outputPromise) {
|
|
const bundle = output === "svg" ? "tex-mml-svg.js" : "tex-mml-chtml.js";
|
|
outputPromise = loadScript(getURLWithCDN(`${getBasePath()}/${bundle}`));
|
|
}
|
|
return outputPromise;
|
|
}
|
|
|
|
export function getMathJax() {
|
|
return window.MathJax;
|
|
}
|