Widget: a code block tagged `c++`, `c#` or `objective-c` shows part of the tag as code

オープン
#578 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@prakashNalla がすでに取り組んでいます。

2026年11月2日 から。

  • #579 @prakashNalla による — オープン

評価

この issue はまだ評価されていません。

説明

bug widget
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

主要言語
TypeScript
スター
13
フォーク
7
平均マージ
3時間 14分
マージ済み PR(30日)
329

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codercops/chatcops のほかの issue

codercops/chatcops の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。