RocketChat / RocketChat/Rocket.Chat

Asterisk `*` in KaTeX mode causes Formatting

Open
#17,531 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

message rendering type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

A * inside a KaTeX block is still interpreted as bold formatting by Rocket.Chat although it shouldn't. This causes visible HTML tags in the rendered KaTeX instead of just the formula.

Steps to reproduce:
  1. Post a message that contains a KaTeX block with two asterisks, or two KaTeX blocks with one asterisk, e.g. $a*b*c=d$
Expected behavior:

Only the formula should be visible, rendered in KaTeX: a*b*c=d. Asterisks inside KaTeX should not be treated as bold formatting.

Actual behavior:

The Asterisks are interpreted as formatting marks, and the rendered KaTeX formula contains HTML tags instead of just the formula:

a<spanclass="copyonly">∗</span><strong>b</strong><spanclass="copyonly">∗</span>c=d
Server Setup Information:

Version of Rocket.Chat Server: 3.0.12
Operating System: Debian 10
Deployment Method: tar
Number of Running Instances: 5
DB Replicaset Oplog: enabled
NodeJS Version: 12.16.3
MongoDB Version: 4.0.18

Client Setup Information
  • Desktop App or Browser Version: Firefox 75.0
  • Operating System: Arch Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported message $a*b*c=d$ in a KaTeX block and compare its rendered output with the expected formula-only result. Trace the message formatting and KaTeX rendering path to find where asterisks are interpreted; done means asterisks remain part of the formula without visible HTML formatting tags.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.