mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
14 lines
514 B
TypeScript
14 lines
514 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
export function convertMathjax(input: string): string {
|
|
const svg = globalThis.MathJax.tex2svg(input).children[0];
|
|
|
|
const style = document.createElement("style") as HTMLStyleElement;
|
|
|
|
const styles = `svg { color: white; font-size: 24px; }`;
|
|
style.appendChild(document.createTextNode(styles));
|
|
|
|
svg.insertBefore(style, svg.children[0]);
|
|
return svg.outerHTML;
|
|
}
|