Widget: a code block tagged `c++`, `c#` or `objective-c` shows part of the tag as code
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Which part?
@chatcops/widget
Package version
dev
What happened?
A code block whose language tag has a symbol in it shows part of the tag as code. renderMarkdown() in packages/widget/src/markdown.ts (line 45) matches the tag with \w*, which stops at the first non-word character, so the rest of the tag ends up inside the block:
renderMarkdown('```c++\nint x;\n```')
// <pre><code>++
// int x;</code></pre>
The same happens with c# (a stray #) and objective-c (a stray -c). Models tag C++ and C# code this way all the time, so these replies start with a junk line.
The tag is also taken from a one-line fence, so ```const x``` renders as <pre><code>x</code></pre> and loses its first word.
What did you expect?
<pre><code>int x;</code></pre>, with the whole tag dropped. I'd match the tag as anything up to the end of the fence line, only when a newline follows it, so a one-line fence keeps all its text, with cases in packages/widget/tests/markdown.test.ts.
How can we reproduce it?
On dev, call renderMarkdown('```c++\nint x;\n```') from packages/widget/src/markdown.ts. The code block starts with ++.
Environment
Node 22, renderMarkdown() run directly on dev
- Ngôn ngữ chính
- TypeScript
- Star
- 13
- Fork
- 7
- Merge trung bình
- 3 giờ 15 phút
- Pull request đã merge (30 ngày)
- 330
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/chatcops
-
Docs: Astro, Nuxt and SvelteKit guides for the serverCó thể đã có người làm @anurag2787 đã nhận 1 ngày trước. Đang mởdocumentation
codercops/chatcops#575 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Server: chatcopsNext(), one catch-all route for Next.jsCó thể đã có người làm @Saifjafri212213 đã nhận 1 ngày trước. Đang mởenhancement server
codercops/chatcops#574 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
@chatcops/react: a <ChatCops> component and useChatCops() hookCó thể đã có người làm @Saifjafri212213 đã nhận 1 ngày trước. Đang mởenhancement widget
codercops/chatcops#573 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
codercops/chatcops#546 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
codercops/chatcops#542 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/chatcops
Issue tương tự
-
area: frontend priority: normal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
formbricks/formbricks#9918 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Chat: Resize question overlayĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
thecodacus/pithagoras#364 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TestAutonomousStop_ReportsObservedState fails under host load: 1s wall-clock ceiling vs 250ms cycleĐang mởtype:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
nightgauge/nightgauge#2909 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày