calvinkei / react-native-mathjax

Render Mathjax content in React Native Webview
MIT License
34 stars 37 forks source link

Offline version #6

Open fredbt opened 6 years ago

fredbt commented 6 years ago

Hi there!

What would it take to use this library offline? Right now it needs to call the MathJax.js script remotely.

Thanks, Fred

mrded commented 6 years ago

Do you know how to attach an external library as a plaintext into webview?

calvinkei commented 6 years ago

simplest way to just make it work is to copy paste the content of https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js to wrapMathjax, but not sure what's the best practice for this

mrded commented 6 years ago

It doesn't look possible to me. Even you embed MathJax.js, it still downloads additional fonts and extensions from the internet.

mrded commented 6 years ago

You can probably download whole MathJax lib into ./assets and share it to the webview via baseUrl.

matei-radu commented 6 years ago

@calvinkei why not require Mathjax as an npm dependency (from npmjs) and inject it in the WebView using the injectedJavaScript prop?

I'd be happy to give it a try and, if it works, make a PR over this weekend.

mrded commented 6 years ago

It's not as simple. Mathjax requires extra remote pluggins from they CDN. If you want to host it locally, you need to make a web server with these plugins, or build a version of Mathjax with all plugins included.

matei-radu commented 6 years ago

Oh, that's unfortunate. Thanks for clarifying.

truongluuxuan commented 5 years ago

Dear Mr @mrded , can you help me for this comment "You can probably download whole MathJax lib into ./assets and share it to the webview via baseUrl." I need Mathjax offline but can't.

mrded commented 5 years ago

@truongluuxuan I'm sorry, I'm not in a context of this problem any longer.

harsh-kukreja commented 3 years ago

Hey @truongluuxuan were you able to load mathjax offline?

truongluuxuan commented 3 years ago

Hey @truongluuxuan were you able to load mathjax offline?

I don't know how to do that. I'm just wondering how can I run mathjax offline