Files
deepseek-harness/packages/client/ui-primitives/src/markdown/CodeBlock.module.css
T

146 lines
3.7 KiB
CSS

/* Visual baseline: deepsuite `@deepseek/md` code-block.css. Highlight colors
stay on the existing shiki `--shiki-*` sheet (not Prism highlight.css). */
.block {
--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner);
--dsl-code-block-border-radius: 12px;
/* Local 11/18 instead of the shared --dsw-font-xs-13: the banner scales
with the markdown 0.875 ladder without shrinking every other xs-13 use. */
--dsl-code-block-banner-font: 11px/18px var(--dsw-font-family);
--dsl-code-block-content-font: var(--dsw-font-markdown-code-block);
--dsl-code-block-background: var(--dsw-alias-markdown-code-block);
position: relative;
margin: 16px 0;
color: var(--dsw-alias-label-primary);
background: var(--dsl-code-block-background);
border-radius: var(--dsl-code-block-border-radius);
}
.block:not(:last-child) {
margin-bottom: 11px;
}
.bannerWrap {
position: sticky;
top: 0;
z-index: 6;
background-color: var(--dsw-alias-bg-base);
border-top-left-radius: var(--dsl-code-block-border-radius);
border-top-right-radius: var(--dsl-code-block-border-radius);
}
.banner {
background: var(--dsl-code-block-banner-background-color);
padding: 9px 14px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
font: var(--dsl-code-block-banner-font);
border-top-left-radius: var(--dsl-code-block-border-radius);
border-top-right-radius: var(--dsl-code-block-border-radius);
}
.infostring {
color: var(--dsw-alias-label-primary);
font-family: var(--ds-font-family-code);
font-size: 11px;
line-height: 18px;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.action {
display: flex;
align-items: center;
flex-shrink: 0;
}
.copyButton {
background-color: rgb(255 255 255 / 0);
border: none;
padding: 0;
margin: 0;
color: inherit;
cursor: pointer;
font: inherit;
}
/* Consumers may turn the stable content node into a viewport without changing
the default CodeBlock layout. */
.content {
display: contents;
}
.block :where(pre) {
font: var(--dsl-code-block-content-font);
padding: 16px;
margin: 0 !important;
overflow-x: auto;
white-space: pre-wrap;
word-break: break-all;
background: var(--dsl-code-block-background);
/* Bottom radii live on <pre>: overflow:hidden on .block would kill the
sticky banner, and this opaque fill otherwise squares off the wrapper. */
border-bottom-left-radius: var(--dsl-code-block-border-radius);
border-bottom-right-radius: var(--dsl-code-block-border-radius);
}
/* Shiki inlines its theme background var; route it to the repo token. */
.block :where(pre.shiki) {
background: var(--dsl-code-block-background) !important;
}
.block :where(pre) code {
font: inherit;
background: none;
padding: 0;
}
.plain {
color: var(--dsw-alias-label-primary);
}
.card :where(pre) {
padding: 6px 18px 16px;
word-break: normal;
overflow-wrap: anywhere;
}
.card[data-code-wrap='false'] {
--dsl-code-block-line-white-space: pre;
}
.card[data-code-wrap='false'] :where(pre) {
white-space: pre;
overflow-wrap: normal;
}
.numbered :where(pre) code {
display: block;
counter-reset: source-line;
white-space: normal;
}
.numbered :where(pre) code > :global(.line) {
position: relative;
display: block;
min-height: 1lh;
padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 12px);
counter-increment: source-line;
white-space: var(--dsl-code-block-line-white-space, pre-wrap);
}
.numbered :where(pre) code > :global(.line)::before {
position: absolute;
inset-inline-start: 0;
width: var(--dsl-code-block-line-number-width);
color: var(--dsw-alias-label-tertiary);
text-align: end;
content: counter(source-line);
user-select: none;
}