# 聊天里的数学问题？

**URL:** https://meta.discourse.org/t/math-in-chat-troubleshooting/274289
**Category:** Bug
**Tags:** math, chat
**Created:** [2023年八月8日 02:19 UTC](https://meta.discourse.org/t/math-in-chat-troubleshooting/274289 "2023-08-08T02:19:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![inducer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inducer/32/319645_2.png) [@inducer](https://meta.discourse.org/u/inducer)
#### Post date: [2023年八月8日 02:19 UTC](https://meta.discourse.org/t/math-in-chat-troubleshooting/274289/1 "2023-08-08T02:19:50Z")

</div>

在聊天中启用数学是否需要特殊步骤？在我的实例（Discourse 3.1，使用

> <https://github.com/discourse/discourse-math/commit/0d8f41759f2a7957486e02c9c5ea34160f6ac1f0>
>
> 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\>

其中包含[此帖子](https://meta.discourse.org/t/adding-maths-support-for-chat/252018)中提到的 chat+math 支持）

数学在普通主题中运行正常，但在聊天中似乎不起作用。我是否遗漏了什么步骤？有什么可以解决的吗？

谢谢！

---

<div class="post-metadata">

### Author: ![inducer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inducer/32/319645_2.png) [@inducer](https://meta.discourse.org/u/inducer)
#### Post date: [2023年八月9日 01:44 UTC](https://meta.discourse.org/t/math-in-chat-troubleshooting/274289/2 "2023-08-09T01:44:57Z")

</div>

我做了一些调查。看起来，在代码的这一点：

> <https://github.com/discourse/discourse-math/blob/69494ca5a4d708e16e35f1daebeaa53e3edbca2c/assets/javascripts/initializers/discourse-math-mathjax.js#L90-L109>

假设要通过 MathJax 处理的元素具有 `math` CSS 类。但是，一个测试聊天消息（我正在使用 `Test $\\alpha$ math?`）在 DOM 元素通过注册的 `decorateChatMessage` 回调运行时似乎没有任何此类元素。

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2023年八月14日 21:24 UTC](https://meta.discourse.org/t/math-in-chat-troubleshooting/274289/3 "2023-08-14T21:24:21Z")

</div>

抓得好，谢谢。这应该通过以下方式修复：

> <https://github.com/discourse/discourse-math/pull/73>
>
> Prior to this fix discourse-math would not correctly be cooked in chat messages.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2023年八月16日 21:24 UTC](https://meta.discourse.org/t/math-in-chat-troubleshooting/274289/4 "2023-08-16T21:24:36Z")

</div>

该主题在上次回复后 2 天自动关闭。不再允许新回复。
