1.6.0 • Published 2 years ago

@masx200/mathjax-module-async v1.6.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

mathjax-module-async

介绍

浏览器中使用的,

mathjax 转化成模块形式异步加载导出,并且不会污染全局变量

支持输入: asciimath,latex,mathml

支持输出: chtml

导出几个方法,把输入的数学公式,渲染成元素,添加到容器中,

不会在加载时自动渲染文档中所有公式

基于 MathJax 版本 3.2.2

加载了以下模块:

[
    "startup",
    "core",
    "input/asciimath",
    "output/chtml",
    "input/tex-full",
    "input/mml",
    "output/chtml/fonts/tex"
]

由于使用了Proxy,所以支持的浏览器必须支持 ES2015

删除了arguments.callee,使用 rollup 打包

https://github.com/mathjax/MathJax-src/issues/850

https://github.com/masx200/MathJax-src

https://github.com/masx200/MathJax

在线演示

https://mathjax-module-async.vercel.app/

https://mathjax-module-async-masx200.netlify.app/

安装教程

yarn add "@masx200/mathjax-module-async"

使用说明

import { rendermath, initmathjax } from "@masx200/mathjax-module-async";

API

类型声明文件

https://github.com/masx200/mathjax-module-async/blob/master/lib/index.ts

rendermath

异步方法,把输入的 数学 格式的文字渲染,并返回 html 字符串。

参数:MathJax:MathJax对象

参数:input:数学公式的文本内容

参数:type:数学公式使用的语言是"latex" | "mathml" | "asciimath"之一

参数:opts:可选参数,传递给渲染函数mathml2chtmlPromise,asciimath2chtmlPromise,tex2chtmlPromise之一的参数,可以通过MathJax.getMetricsFor获取

返回值为Promise<string>,渲染后的数学公式的html文本。

initmathjax

异步加载 MathJax 并返回 MathJax

参数:baseurl:mathjax的起始网址,默认为https://unpkg.com/mathjax@3.2.2/es5

1.5.2

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.3

3 years ago

1.2.0

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.3.2

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago