Widget: a code block tagged `c++`, `c#` or `objective-c` shows part of the tag as code
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/chatcops のほかの issue
-
fix(core): Cohere and Voyage rerankers bypass non-positive limit check on NaN topN and send invalid null payload対応中かも @bhushan4work が 1 日前に担当しました。 オープンbug
codercops/chatcops#582 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Docs: Astro, Nuxt and SvelteKit guides for the server対応中かも @anurag2787 が 1 日前に担当しました。 オープンdocumentation
codercops/chatcops#575 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Server: chatcopsNext(), one catch-all route for Next.js対応中かも @Saifjafri212213 が 1 日前に担当しました。 オープンenhancement server
codercops/chatcops#574 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
@chatcops/react: a <ChatCops> component and useChatCops() hook対応中かも @Saifjafri212213 が 1 日前に担当しました。 オープンenhancement widget
codercops/chatcops#573 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
codercops/chatcops#546 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
codercops/chatcops の issue をすべて見る
似ている issue
-
needs investigation
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area:visualizer tech-debt
難易度 2/5 1時間未満 初心者へのやさしさ 66/100
jmbarzee/temporal-architect#292 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
riverqueue/river#1576 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
colbymchenry/codegraph#3228 ·
メンテナーはふだん 1 日以内に返信