bug: AI composer renders intra-word _ and * as italic/bold (e.g. my_file_name.js -> my<em>file</em>name.js)

Đang mở
#1,372 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@rahulnits-sketch đang làm issue này rồi.

Từ ngày 23/9/2026.

  • #1375 của @rahulnits-sketch — đang mở
  • #1376 của @ishan-one8 — đã đóng, không merge
  • #1418 của @swarnendusahu10-dotcom — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, react
Lĩnh vực
frontend

Hướng nghiên cứu

Start in packages/react/src/lib/contentEditableComposer.js, following renderComposerMarkdown into appendMarkdown, and run the provided jsdom reproduction from the repository root. Check the listed identifier, dunder, and arithmetic examples; the work is complete when intra-word underscores and asterisks remain literal while valid emphasis still renders correctly.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description:

The AI-composer Markdown renderer (renderComposerMarkdown → appendMarkdown in packages/react/src/lib/contentEditableComposer.js) treats any _, *, __ or ** as an emphasis marker, even when it appears inside a word. As a result, AI suggestions that contain code identifiers, file paths, dunder names, or arithmetic are silently corrupted into <em>/<strong> when rendered inline in the composer.

  • EmbeddedChat @rocket.chat/embeddedchat-react 0.2.2
  • Commit 0654e5c7774b9762ed84d4a2bfde89b8f878a9d6 (branch develop)
  • Node v24.0.0, OS macOS
Steps to reproduce:
  1. Check out develop at commit 0654e5c.

  2. Render a string through the composer's Markdown renderer — i.e. as an AI suggestion, which calls renderComposerMarkdown(element, text). Minimal standalone repro (Node + jsdom, run from the repo root):

    import { JSDOM } from "jsdom";
    const dom = new JSDOM(`<!DOCTYPE html><body></body>`);
    global.document = dom.window.document;
    global.NodeFilter = dom.window.NodeFilter;
    global.window = dom.window;
    const { renderComposerMarkdown } = await import(
      "./packages/react/src/lib/contentEditableComposer.js"
    );
    const el = document.createElement("div");
    renderComposerMarkdown(el, "my_file_name.js");
    console.log(el.innerHTML);
    
  3. Observe the emitted HTML.

Expected behavior:

Underscores/asterisks inside a word should not be treated as emphasis. my_file_name.js should render literally as my_file_name.js (matching CommonMark, where emphasis delimiters must be left/right-flanking, i.e. at word boundaries).

Actual behavior:

Intra-word markers are parsed as emphasis:

Input Rendered HTML
my_file_name.js my<em>file</em>name.js
__init__ <strong>init</strong>
call foo_bar_baz() now call foo<em>bar</em>baz() now
2 * 3 * 4 = 24 2 <em> 3 </em> 4 = 24

Searched before filing: open + closed issues for "composer markdown formatting", "italic bold asterisk", and "underscore". The closest existing issue is #1315 (parseEmoji converts only the last emoji shortname) — a different function, but the same class of hand-rolled inline-text parser producing wrong output. This composer intra-word emphasis case does not appear to be tracked yet.

Ngôn ngữ chính
JavaScript
Star
171
Fork
421
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RocketChat/EmbeddedChat

Tất cả issue của RocketChat/EmbeddedChat

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.