Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: digger on February 29, 2016, 02:04:49 AM

Title: MathJax
Post by: digger on February 29, 2016, 02:04:49 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4077)

(https://img.shields.io/github/release/realdigger/SMF-MathJax.svg) (https://travis-ci.org/realdigger/SMF-MathJax.svg?branch=master) (https://img.shields.io/badge/SMF-2.0-blue.svg?style==flat) (https://img.shields.io/badge/SMF-2.1-blue.svg?style==flat) (https://img.shields.io/github/license/realdigger/SMF-MathJax.svg)

This mod integrates the MathJax library into SMF forum. MathJax is the modern JavaScript-based LaTeX rendering solution for the Internet. Mod uses the MathJax CDN. The CDN will automatically arrange for your readers to download MathJax files from a fast, nearby server. And since bug fixes and patches are deployed to the CDN as soon as they become available, your pages will always be up to date with the latest browser and devices. https://www.mathjax.org

This mod is licensed under GPLv3 license.

Mod adds new bbcode [latex] with buttons for standard and inline placing.

Some examples:
Code: [Select]
\[ E=mc^2 \]
[latex] E=mc^2 [/latex]
Some text before [latex=inline] E=mc^2 [/latex] some text after

GitHub repository: https://github.com/realdigger/SMF-MathJax-Mod

Changelog:
1.4.3
Fix quick modify update issue for SMF 2.1.

1.4.2
Fix quick modify update issue. Change MathJax link to 2.7.2 version.

1.4.1
Change MathJax script url from cdn.mathjax.org to cdnjs.cloudflare.com. We recommend to update mod as soon as possible.

1.4
Fix message preview
Add support for SMF 2.1


Этот мод интегрирует библиотеку MathJax в SMF. MathJax это современное решение для рендеринга формул LaTeXis посредством JS в браузерах. Мод загружает библиотеку из официальной CDN разработчиков, так что у вас всегда будет самая актуальная версия с последними обновлениями и исправлениями. https://www.mathjax.org

Этот мод распространяется под лицензией GPLv3.

Мод добавляет новый бб-код [latex] с кнопками для размещения формулы между строк или в строке с обтеканием текстом.

Примеры использования:
Code: [Select]
\[ E=mc^2 \]
[latex] E=mc^2 [/latex]
Some text before [latex=inline] E=mc^2 [/latex] some text after

GitHub репо: https://github.com/realdigger/SMF-MathJax-Mod

История:
1.4.3
Исправлено обновление при быстром редактировании для SMF 2.1.

1.4.2
Исправлено обновление при быстром редактировании. Скрипт обновлен до версии 2.7.2.

1.4.1
Адрес загрузки скрипта изменен с cdn.mathjax.org на cdnjs.cloudflare.com. Рекомендуется обновить мод как можно скорее.

1.4
Исправлено отображение формул в предварительном просмотре
Добавлена поддержка SMF 2.1
Title: Re: MathJax
Post by: noisemarine on March 11, 2016, 08:07:46 PM
This is a really cool Mod. Thanks for making it available.  :)
Title: Re: MathJax
Post by: Study Force on March 12, 2016, 01:04:58 AM
Is anyone else having a problem getting this to parse when clicking "preview" while posting?
Title: Re: MathJax
Post by: noisemarine on March 12, 2016, 02:05:37 AM
I couldn't get it to preview, either. Thought it wasn't working.  :o

Still, I hit https://en.wikibooks.org/wiki/LaTeX/Mathematics to brush up on LaTeX and it works fine.
Title: Re: MathJax
Post by: digger on April 30, 2016, 10:03:22 AM
Is anyone else having a problem getting this to parse when clicking "preview" while posting?
Fixed in 1.4 version
Title: Re: MathJax
Post by: Study Force on May 13, 2016, 12:00:22 AM
Still didn't preview it properly :-\
Title: Re: MathJax
Post by: gevv on November 05, 2016, 04:15:09 AM
hi,

How can i disable text-align: center;
Title: Re: MathJax
Post by: digger on November 13, 2016, 05:51:43 PM
hi,

How can i disable text-align: center;
https://github.com/realdigger/SMF-MathJax-Mod/issues/2
Title: Re: MathJax
Post by: Study Force on October 05, 2017, 11:38:54 AM
I'm looking at the difference between 1.3 and 1.4 and there are no differences that would suggest previews will work
Title: Re: MathJax
Post by: digger on October 05, 2017, 11:44:10 AM
I'm looking at the difference between 1.3 and 1.4 and there are no differences that would suggest previews will work
https://github.com/realdigger/SMF-MathJax/blob/7ed054b3cc34f15608cd2b86bc6bdc743dae7588/modification.xml
Title: Re: MathJax
Post by: Study Force on October 28, 2017, 12:30:33 AM
Found the fix...

Needed to add:

Code: [Select]
<script type="text/x-mathjax-config">
window.setInterval(loadPreview, 100);
function loadPreview(){MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}
</script>
Title: MathJax CDN shut down
Post by: wunderbunny on November 27, 2017, 11:51:09 AM
Hello digger, thank you very much for providing this mod.

I noticed on the MathJax web site (https://www.mathjax.org/cdn-shutting-down/) that they have changed to a new host for their script:

So it might be necessary to change this:
Code: [Select]
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?config=default,Safe"></script>';
to this:
Code: [Select]
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js??config=default,Safe"></script>';
I included the "https:" so that I could avoid having mixed content on my site.
Title: Re: MathJax CDN shut down
Post by: digger on November 27, 2017, 11:55:55 AM
Hello digger, thank you very much for providing this mod.

I noticed on the MathJax web site (https://www.mathjax.org/cdn-shutting-down/) that they have changed to a new host for their script:

So it might be necessary to change this:
Code: [Select]
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?config=default,Safe"></script>';
to this:
Code: [Select]
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js??config=default,Safe"></script>';
I included the "https:" so that I could avoid having mixed content on my site.
Thanks for this report. Will change cdn host ASAP.
Title: Re: MathJax
Post by: jack001 on June 28, 2018, 10:39:51 AM
I was able to install it on 2.1 beta 4. But how to uninstall it. Can't see under packages