Widget: a code block tagged `c++`, `c#` or `objective-c` shows part of the tag as code
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 13
- Forks
- 7
- Ø Merge
- 3 Std. 11 Min.
- Gemergte PRs (30 T.)
- 330
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus codercops/chatcops
-
Ingest: a crawl source for sites without a sitemapEvtl. vergeben @bhushan4work hat das vor 1 Tag übernommen. Offenenhancement
codercops/chatcops#586 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
fix(core): Cohere and Voyage rerankers bypass non-positive limit check on NaN topN and send invalid null payloadEvtl. vergeben @bhushan4work hat das vor 2 Tagen übernommen. Offenbug
codercops/chatcops#582 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docs: Astro, Nuxt and SvelteKit guides for the serverEvtl. vergeben @anurag2787 hat das vor 3 Tagen übernommen. Offendocumentation
codercops/chatcops#575 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Server: chatcopsNext(), one catch-all route for Next.jsEvtl. vergeben @Saifjafri212213 hat das vor 3 Tagen übernommen. Offenenhancement server
codercops/chatcops#574 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
@chatcops/react: a <ChatCops> component and useChatCops() hookEvtl. vergeben @Saifjafri212213 hat das vor 3 Tagen übernommen. Offenenhancement widget
codercops/chatcops#573 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in codercops/chatcops
Ähnliche Issues
-
check:passed streams:remove
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 67/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug priority-p1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
beginner blocked
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
hiero-ledger/hiero-sdk-js#4670 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Exploratory] Expense - 2 selected drop-down is shown twice when selecting hold from more option.OffenMonthly Not a priority
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Expensify/App#106080 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag