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 the mod (https://custom.simplemachines.org/index.php?mod=4077)



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:
\[ 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] с кнопками для размещения формулы между строк или в строке с обтеканием текстом.

Примеры использования:
\[ 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: Biology Forums 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
Quote from: Shuban on March 12, 2016, 01:04:58 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: Biology Forums 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
Quote from: gevv on November 05, 2016, 04:15:09 AM
hi,

How can i disable text-align: center;
https://github.com/realdigger/SMF-MathJax-Mod/issues/2
Title: Re: MathJax
Post by: Biology Forums 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
Quote from: 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
https://github.com/realdigger/SMF-MathJax/blob/7ed054b3cc34f15608cd2b86bc6bdc743dae7588/modification.xml
Title: Re: MathJax
Post by: Biology Forums on October 28, 2017, 12:30:33 AM
Found the fix...

Needed to add:

<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:
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?config=default,Safe"></script>';

to this:
<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
Quote from: 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:
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?config=default,Safe"></script>';

to this:
<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
Title: Re: MathJax
Post by: moyack on October 22, 2022, 11:46:40 PM
Hi.

I just want to share an upgrade to this mod that works for SMF2.1.X. It uses only hooks for better compatibility.

Link to the mod: *removed link

Because it's my first package for SMF, and it's based on the work of @digger I'm open to hear suggestions and improve the way to give credits for its original work. I hope my recognition to digger has been adequate.

* Removed the link until you get the okay from the author. Once the okay is given, please re-post it ~ Steve
Title: Re: MathJax
Post by: Diego Andrés on October 22, 2022, 11:53:08 PM
Looks like he's still maintaining the mod on github, so you could maybe send a pull request with your improvements?
Nice job!
Title: Re: MathJax
Post by: Steve on October 24, 2022, 04:57:39 AM
@moyack ... it's been determined that there was no problem with the link you posted so could you post it again with my apologies?
Title: Re: MathJax
Post by: moyack on October 25, 2022, 09:03:50 PM
Quote from: Steve on October 24, 2022, 04:57:39 AM@moyack ... it's been determined that there was no problem with the link you posted so could you post it again with my apologies?
Hi, no problem. I'll do it with pleasure  ;) .

https://gitlab.com/moyack/mathjax-for-smf2.1.x for the source code. And the package: https://gitlab.com/moyack/mathjax-for-smf2.1.x/-/raw/main/Releases/SMF-MathJax-1.4.4.zip

Huggs!!!
Title: Re: MathJax
Post by: digger on October 28, 2022, 04:01:54 AM
Quote from: moyack on October 22, 2022, 11:46:40 PMHi.

I just want to share an upgrade to this mod that works for SMF2.1.X. It uses only hooks for better compatibility.

Link to the mod: *removed link

Because it's my first package for SMF, and it's based on the work of @digger I'm open to hear suggestions and improve the way to give credits for its original work. I hope my recognition to digger has been adequate.

* Removed the link until you get the okay from the author. Once the okay is given, please re-post it ~ Steve
I think this is a topic to support this mod, and not to advertise other people's copies of it. If you would like to improve the mod, you can send a pull request to github instead of copying the mod.