Repository navigation
fix(widget): drop the whole language tag from a code block - #579
Merged
Merged
Conversation
anurag629
approved these changes
Nov 5, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @prakashNalla, the change is right. The new pattern at packages/widget/src/markdown.ts:45 takes everything up to the first newline as the tag, and only when a newline follows, so a c++, c# or objective-c tag is dropped whole and a one-line block keeps its first word. The tests cover each case from #578, and the tag with a space after it and the unclosed block expect the same output dev gives today.
Member
|
Merged, thanks @prakashNalla. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
renderMarkdown()matched a code block's language tag with\w*, so a tag with a symbol (c++,c#,objective-c) left the rest of the tag at the top of the block, and a one-line block like```const x```lost its first word as if it were the tag. The tag is now anything up to the end of the fence line, and only when a newline follows it. Patch changeset for@chatcops/widget.Closes #578
How I tested this
Added cases to
packages/widget/tests/markdown.test.tsforc++,c#,objective-candtstags and for a one-line block. The first three and the one-line case fail without the change. I also added a tag with a space after it (```ts) and a block that is still streaming with no closing fence; both render the same as ondev.pnpm -r buildandpnpm -r typecheck: passpnpm test: 2430 tests passed (65 skipped)pnpm lint: passespnpm size: all bundles still under their limits, the chat panel is 18.89 of 19 kBAI assistance
Claude helped me w/ understand the issue
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserver