Skip to content

Commit 9089c2d

Browse files
fix(ui): satisfy fenced code checks
1 parent 11c413d commit 9089c2d

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎ui/src/components/markdown-code-blocks.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ for (const [language, definition] of Object.entries({
4545
}
4646
hljs.registerAliases("shell", { languageName: "bash" });
4747

48+
function codeBlockRenderEnv(env: unknown): Partial<MarkdownRenderEnv> | undefined {
49+
// SAFETY: markdown-it types renderer env as unknown; this internal renderer
50+
// receives the normalized options object, or undefined from direct calls.
51+
return env as Partial<MarkdownRenderEnv> | undefined;
52+
}
53+
4854
function shouldRenderCodeBlockCopy(env: unknown): boolean {
49-
return (env as Partial<MarkdownRenderEnv> | undefined)?.codeBlockChrome !== "none";
55+
return codeBlockRenderEnv(env)?.codeBlockChrome !== "none";
5056
}
5157

5258
function shouldRenderCodeBlockInteraction(env: unknown): boolean {
53-
return (env as Partial<MarkdownRenderEnv> | undefined)?.codeBlockInteraction === "interactive";
59+
return codeBlockRenderEnv(env)?.codeBlockInteraction === "interactive";
5460
}
5561

5662
function encodeBlockArtCodeBlockCopyPayload(value: string): string {

‎ui/src/styles/chat/text.css‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,7 @@
408408
cursor: var(--cursor-action);
409409
}
410410

411-
:is(.chat-text, .chat-thinking)
412-
:where(details > summary)::-webkit-details-marker {
411+
:is(.chat-text, .chat-thinking) :where(details > summary)::-webkit-details-marker {
413412
display: none;
414413
}
415414

@@ -796,9 +795,7 @@
796795

797796
/* The preview lines plus the code element's own 4px/8px/6px vertical box. */
798797
.code-block-wrapper.is-collapsible:not(.is-expanded) .code-block-viewport {
799-
max-height: calc(
800-
var(--code-block-line-height) * var(--code-block-preview-lines) + 18px
801-
);
798+
max-height: calc(var(--code-block-line-height) * var(--code-block-preview-lines) + 18px);
802799
overflow-y: hidden;
803800
}
804801

0 commit comments

Comments
 (0)