如何从 typescript 方法返回 Mathjax 渲染的结果(同步)?

问题描述 投票:0回答:0

在全球范围内,我想将带有 asciimath 公式的 HTML 文件转换为文件内部包含 SVG 而不是 asciimath 的其他 HTML 文件。

为此,我尝试在打字稿(运行思想节点)上编写命令行应用程序。

为了将 asciimath 公式转换为 SVG,我想创建一个具有转换方法的类(使用 Mathjax 库):

class AsciimathFormula {

    private readonly asciimath: string;

    constructor(asciimath: string) {
        this.asciimath = asciimath;
    }

    get svg(): string {
        // return svg representation of this.asciimath using mathjax
    }
}

Mathjax的文档有回调的例子,但是我想同步得到结果

如何编写 svg 方法的主体?

javascript node.js typescript mathjax
© www.soinside.com 2019 - 2024. All rights reserved.