inducer
(Andreas Klƶckner)
August 8, 2023, 2:19am
1
Are there special steps require to enable math in chat? On my instance (Discourse 3.1, with
committed 11:31PM - 18 Jul 23 UTC
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.ā¦ 4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)
---
updated-dependencies:
- dependency-name: word-wrap
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
which includes the chat+math support mentioned in this post )
math works fine in normal topics, but in chat, it does not appear to work. Am I missing a step? Anything I could do to troubleshoot?
Thanks!
1 Like
inducer
(Andreas Klƶckner)
August 9, 2023, 1:44am
2
Iāve done a little bit of digging. It seems that, at this point in the code:
function mathjax(elem, opts) {
if (!elem) {
return;
}
let mathElems;
if (opts.enable_asciimath) {
mathElems = elem.querySelectorAll(".math, .asciimath");
} else {
mathElems = elem.querySelectorAll(".math");
}
if (mathElems.length > 0) {
const isPreview = elem.classList.contains("d-editor-preview");
ensureMathJax(opts).then(() => {
mathElems.forEach((mathElem) => decorate(mathElem, isPreview));
});
}
}
it is assumed that the elements to be put through MathJax have a math
CSS class. But a test chat message (Iām using Test $\alpha$ math?
) does not seem to have any such elements when the DOM elements are run through the registered decorateChatMessage
callback.
1 Like
Good catch thanks. This should be fixed by:
discourse:main
ā discourse:correctly-enables-features
opened 09:18PM - 14 Aug 23 UTC
Prior to this fix discourse-math would not correctly be cooked in chat messages.
5 Likes
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.