| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- /* 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);
- position: relative;
- margin: 16px 0;
- color: var(--dsw-alias-label-primary);
- background: var(--dsw-alias-markdown-code-block);
- 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;
- gap: 12px;
- }
- .copyButton {
- background-color: rgb(255 255 255 / 0);
- border: none;
- padding: 0;
- margin: 0;
- color: inherit;
- cursor: pointer;
- font: inherit;
- }
- .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(--dsw-alias-markdown-code-block);
- /* 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(--dsw-alias-markdown-code-block) !important;
- }
- .block :where(pre) code {
- font: inherit;
- background: none;
- padding: 0;
- }
- .plain {
- color: var(--dsw-alias-label-primary);
- }
- .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;
- }
- /* Alternate content is a figure; its actions overlay instead of taking a title row. */
- .preview.showingPreview {
- background: transparent;
- }
- .preview .bannerWrap {
- position: absolute;
- top: 8px;
- right: 8px;
- z-index: 1;
- background: transparent;
- }
- .preview .banner {
- padding: 2px;
- background: var(--dsw-alias-bg-base);
- border: 0;
- border-radius: 8px;
- box-shadow: var(--dsw-elevation-panel);
- }
- .preview .action {
- gap: 2px;
- }
- .iconButton {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 32px;
- height: 32px;
- border-radius: 6px;
- color: var(--dsw-alias-label-secondary);
- }
- .iconButton span {
- display: flex;
- }
- .iconButton:hover {
- color: var(--dsw-alias-label-primary);
- background: var(--dsw-alias-interactive-bg-hover);
- }
- .preview:not(.showingPreview) :where(pre) {
- padding-top: 48px;
- }
- @media (hover: hover) and (pointer: fine) {
- .preview .bannerWrap {
- opacity: 0;
- pointer-events: none;
- }
- .preview:hover .bannerWrap,
- .preview:focus-within .bannerWrap {
- opacity: 1;
- pointer-events: auto;
- }
- }
- @media (pointer: coarse) {
- .preview {
- padding-bottom: 56px;
- }
- .preview .bannerWrap {
- top: auto;
- bottom: 8px;
- }
- .preview .iconButton {
- width: 44px;
- height: 44px;
- }
- .preview:not(.showingPreview) :where(pre) {
- padding-top: 16px;
- }
- }
|