Commit Graph

36 Commits

Author SHA1 Message Date
Jarek Radosz 2984713f68
UX: Hide mathjax loading toast (#78) 2024-02-05 14:13:54 +01:00
Jarek Radosz 956fd3ee18
DEV: Update linting (#77) 2024-01-16 17:57:10 +01:00
Joffrey JAFFEUX 69494ca5a4
FIX: prevents inline span to be forced into blocks (#69)
Prior to this fix the "block" style would be used on any node (block or inline).
2023-01-27 17:05:55 +01:00
Joffrey JAFFEUX c0179a56f8
FIX: ensures chat is present/enabled (#68)
Without this when chat is disabled the API is not supercharged with these methods and it will cause an exception:

```
Uncaught (in promise) TypeError: t.decorateChatMessage is not a function
    initialize discourse-math-mathjax.js:102
    initialize discourse-math-mathjax.js:119
    withPluginApi discourse-f7231bd5d10aa613b323a0cac71d8003baa74ef74f674fe4f91e4857994e661b.br.js:4735
    initialize discourse-math-mathjax.js:118
    initialize discourse-f7231bd5d10aa613b323a0cac71d8003baa74ef74f674fe4f91e4857994e661b.br.js:67
    runInstanceInitializers Ember
    each dag-map.js:192
    walk dag-map.js:121
    each dag-map.js:66
    topsort dag-map.js:72
    Ember 4
    invoke queue.ts:201
    flush queue.ts:98
    flush deferred-action-queues.ts:75
    _end index.ts:616
    _boundAutorunEnd index.ts:257
discourse-math-mathjax.js:102
```
2023-01-18 14:39:57 +01:00
Joffrey JAFFEUX 6f59c46912
DEV: adds chat support (#67)
This commit is also removing jquery code and simplifying code.

Note that discourse-math is currently causing jumpy-ness in topics or in chat as the resulting processed mathjax element has a different size than the initial text node.
2023-01-18 12:35:27 +01:00
qnxor abe2daf0f3
katex: copy-paste support for Latex code, upgraded to katex 0.16.0 (#54) 2022-11-16 14:39:48 -05:00
Isaac Janzen bf07db4916
DEV: Remove use of run-loop-and-computed-dot-access (#55)
Context: https://deprecations.emberjs.com/v3.x/#toc_deprecated-run-loop-and-computed-dot-access
2022-06-17 13:31:08 +02:00
qnxor dbd7c1c84b
FEATURE: support equation labelling and referencing in KaTeX (more mathjax compatibility) (#53) 2022-06-15 10:25:24 -04:00
qnxor 4b4ad9d532
FEAT: enable persistent macros in Katex, update Katex to 0.15.6 (#51) 2022-06-07 11:19:59 -04:00
Jarek Radosz c802e0d5e1
DEV: Lose the es6 suffix (#46) 2022-03-05 17:21:55 +01:00
Martin Brennan cacbd04bb2
DEV: Update code for eslint object-shorthand-rule (#39)
See 4f7aba06c0
2021-11-10 12:02:26 +11:00
Joffrey JAFFEUX c925f7e2a3
FIX: prevents md processing if plugin is disabled (#31) 2021-04-23 14:05:21 +02:00
Sam Saffron 152a7b5c60
FIX: Broken preview for single math equations
Previously we would remove elements from the DOM, this caused Ember to
get extremely confused and blow up its rendering.

Instead only hide the element, do not remove it.
2021-04-22 11:29:10 +10:00
Joffrey JAFFEUX eb335efe8e
DEV: prettier 2.2.1 (#26) 2021-01-27 10:36:08 +01:00
jjaffeux 6367e2b5fb Revert "DEV: enforces no-var (#22)"
This reverts commit eecb13b486.
2020-10-13 15:41:08 +02:00
Joffrey JAFFEUX eecb13b486
DEV: enforces no-var (#22) 2020-10-13 11:36:21 +02:00
Joffrey JAFFEUX e3068bb476
DEV: apply coding standards (#20) 2020-09-04 13:22:43 +02:00
Robin Ward 08c8a94f7e Remove deprecation 2020-07-06 14:49:01 -04:00
Joe 595fc8675b FIX: don't wrap inline math (#17)
* adds CSS classes for styling

* don't wrap inline-math

* adds comment about selectors
2019-09-10 14:56:59 +10:00
Joe 9615034d78 FEATURE: Responsive equations (#16)
* adds class to math containers for styling
* adds responsive styles
2019-09-09 15:08:01 +10:00
Penar Musaraj 23ab984862 Add id to decorateCooked API call for KaTeX as well 2019-06-20 15:47:00 -04:00
Penar Musaraj e509c6f6e4 Add id to decorateCooked API call 2019-06-20 10:14:57 -04:00
Penar Musaraj 024ea27fb9 Run Prettier 2019-06-14 13:28:18 -04:00
Penar Musaraj 9810a98d21 One more eslint fix 2019-06-14 12:50:17 -04:00
Penar Musaraj 25a65eacc9 Fix eslint 2019-06-14 12:47:22 -04:00
Daniel Hollas dce1a1b0a1 FEATURE: Add KaTeX rendering support (#15)
* FEATURE: Add KaTeX in-browser rendering support.

* Remove ttf fonts from KaTeX

* Update KaTeX to v0.10.1, fix paths to fonts.

Font loading was fixed by rebuilding KaTeX
and specifiying absolute paths to fonts in CSS:
Steps to build KaTeX:

1. `git clone https://github.com/KaTeX/KaTeX.git && cd KaTeX`
    `git submodule update --init --recursive`

2. Change paths to fonts:
    `sed -ri 's/@font-folder.+$/@font-folder:
"\/plugins\/discourse-math\/katex\/fonts";/'
submodules/katex-fonts/fonts.less`

3. Disable TTF fonts:
   `export USE_TTF=false`
    Alternatively, we could modify `.browserslistrc` to match what
Discourse supports

3. Build KaTeX
   `yarn && yarn builld`

4. Copy `katex.min.js` and `katex.min.css` from `dist/` to
`discourse-math/public/katex/`

5. Update fonts, copy woff and woff2 files from
`submodules/katex-fonts/fonts`

* Minor copy edit to settings

Mark MathKJax only settings

* Add Mhchem extension for KaTeX.

It is already automatically loaded for MathJaX.
2019-03-05 07:35:00 +11:00
Kyle Zhao d98bc41f18 FIX: configure mathjax to use CDN (#14) 2018-11-22 09:11:53 +11:00
David Taylor 199c8387a1 DEV: Apply prettier 2018-10-22 19:49:32 +01:00
Sam fd5258cb3c SECURITY: do not allow tags in math wrapper 2018-08-17 16:14:27 +10:00
Sam 28162e9ded MathJax upgrade to version 2.7.5 2018-08-08 11:58:37 +10:00
mcmcclur 05d52f593f Add asciimath processing (#10)
This version sets the new asciimath parsing to be an option. It also deals with the old zoom_on_hover and enable_accessibility options a bit better.
2018-05-29 08:54:56 +10:00
Sam 0329745f84 don't decorate non math 2017-11-20 15:06:24 +11:00
Guo Xiang Tan 669f756b34 Make eslint happy. 2017-08-02 18:18:43 +09:00
mcmcclur 611840a32d Add options for zoom and accessibility (#6)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
2017-07-28 16:14:55 -04:00
Sam 84d7bfc02f bug fixes 2017-07-06 17:15:37 -04:00
Sam 5b22a196fa Initial commit 2017-07-06 16:50:38 -04:00