Mathjax脱机以进行Web视图

Gau*_*jan 5 offline mathjax react-native

通过将mathjax cdn链接为react native来使用webview呈现数学内容是很常见的。但是如何解决使其脱机的问题。

  1. 有没有办法在本地维护该捆绑包?

  2. 甚至喜欢吗?

  3. 捆绑包的大小是多少?我不希望我的应用程序大小超过10mb。

Gau*_*jan 4

从以下位置下载您的 mathjax

http://docs.mathjax.org/en/latest/installation.html

进入=> android/app/src/main/assets/

现在在您的 webview html 代码中设置脚本引用

<script src="file:///android_asset/MathJax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
Run Code Online (Sandbox Code Playgroud)

以及 html 中必要的配置。另请确保将基本 url 设置为您的文件夹名称。

<WebView source={{ html, baseUrl: 'file:///android_asset/MathJax/' }} />
Run Code Online (Sandbox Code Playgroud)

您还可以https://github.com/mathjax/MathJax-grunt-cleaner通过删除不使用的不必要的字体和格式来减少 Mathjax 资源大小。