MarkdownText.module.css 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. /* Visual baseline: deepsuite `@deepseek/md` markdown.css, adapted to CSS
  2. Modules. Cite pills and header anchors are absent (no matching DOM).
  3. Token names match that sheet. */
  4. .markdown {
  5. min-width: 0;
  6. overflow-wrap: anywhere;
  7. font: var(--dsw-font-markdown-base);
  8. color: var(--dsw-alias-label-primary);
  9. }
  10. .markdown strong {
  11. font-weight: 600;
  12. }
  13. .markdown h1 {
  14. font: var(--dsw-font-markdown-h1);
  15. margin: 32px 0 16px;
  16. }
  17. .markdown h2 {
  18. font: var(--dsw-font-markdown-h2);
  19. margin: 32px 0 16px;
  20. }
  21. .markdown h3 {
  22. font: var(--dsw-font-markdown-h3);
  23. margin: 32px 0 16px;
  24. }
  25. .markdown h4 {
  26. font: var(--dsw-font-markdown-h4);
  27. margin: 16px 0;
  28. }
  29. .markdown :where(h5, h6) {
  30. font: var(--dsw-font-markdown-base-strong);
  31. margin: 16px 0;
  32. }
  33. .markdown :where(h1, h2, h3, h4, h5, h6) strong {
  34. font-weight: inherit;
  35. }
  36. .markdown p {
  37. margin: 16px 0;
  38. }
  39. /* Tighten h4–h6 against a following list (design: 8px gap). */
  40. .markdown :where(h4, h5, h6) + :where(ul, ol) {
  41. margin-top: 8px;
  42. }
  43. .markdown :where(h4, h5, h6):has(+ :where(ul, ol)) {
  44. margin-bottom: 8px;
  45. }
  46. .markdown a,
  47. .markdown .fileLink {
  48. /* deepsuite markdown.css uses brand-text (blue in newDesign); this sheet
  49. keeps design-platform brand-text as near-black, so links use the
  50. dedicated link alias instead. */
  51. color: var(--dsw-alias-link);
  52. font-weight: 500;
  53. transition: box-shadow var(--ds-transition-duration) var(--ds-ease-in-out);
  54. position: relative;
  55. text-decoration: none;
  56. /* Transparent hit-area padding; literal zero-alpha only (no painted color). */
  57. border-left: 3px solid rgb(255 255 255 / 0);
  58. border-right: 3px solid rgb(255 255 255 / 0);
  59. border-top: 2px solid rgb(255 255 255 / 0);
  60. border-bottom: 2px solid rgb(255 255 255 / 0);
  61. margin-left: -3px;
  62. margin-right: -3px;
  63. }
  64. .markdown a:hover,
  65. .markdown a:focus {
  66. outline: none;
  67. text-decoration: underline dotted var(--dsw-alias-link);
  68. text-underline-offset: 3px;
  69. }
  70. .markdown a:focus-visible,
  71. .fileMention:focus-visible {
  72. box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary);
  73. }
  74. /* Leading link-category glyph inside anchors, file mentions, and
  75. URL-promoted inline code: outline glyphs ride the link's currentColor.
  76. 1.1em keeps the glyph proportional to the surrounding text's size (it
  77. shrinks with the code chip's 0.875em); the small negative offset seats
  78. its optical center on the cap height. */
  79. .linkIcon {
  80. flex: none;
  81. width: 1.1em;
  82. height: 1.1em;
  83. vertical-align: -0.25em;
  84. margin-right: 5px;
  85. }
  86. .markdown :where(ul, ol) {
  87. margin: 16px 0;
  88. padding-left: 18px;
  89. }
  90. .markdown li:not(:first-child) {
  91. margin-top: 6px;
  92. }
  93. .markdown li > :where(ul, ol) {
  94. margin-top: 4px;
  95. }
  96. .markdown li::marker {
  97. line-height: 24px;
  98. color: var(--dsw-alias-label-secondary);
  99. }
  100. /* Nested ol under ul/ol: markers inside (models sometimes emit this shape). */
  101. .markdown :where(ul, ol) ol {
  102. list-style-position: inside;
  103. padding-left: 0;
  104. }
  105. .markdown :where(ul, ol) ol li p {
  106. display: inline;
  107. }
  108. .markdown li > p {
  109. margin: 8px 0;
  110. }
  111. .markdown li > *:first-child {
  112. margin-top: 0;
  113. }
  114. /* Keep list-nested code-block vertical margins (design: +4px vs other last children). */
  115. .markdown li > *:last-child:not(:global(.md-code-block)) {
  116. margin-bottom: 0;
  117. }
  118. .markdown hr {
  119. display: block;
  120. border: none;
  121. height: 0.5px;
  122. margin: 32px 0;
  123. background: var(--dsw-alias-border-l2);
  124. }
  125. .markdown blockquote {
  126. border-left: 2px solid var(--dsw-alias-label-caption);
  127. margin: 16px 0 0;
  128. padding-left: 14px;
  129. }
  130. .markdown pre {
  131. margin: 16px 0;
  132. font-family: var(--ds-font-family-code);
  133. overflow: auto;
  134. }
  135. .markdown :not(pre) > code {
  136. display: inline-flex;
  137. align-items: center;
  138. box-sizing: border-box;
  139. font: var(--dsw-font-markdown-code);
  140. font-family: var(--ds-font-family-code);
  141. font-size: 0.875em !important;
  142. background-color: var(--dsw-alias-markdown-inline-code);
  143. border: 0.5px solid var(--dsw-alias-border-l1);
  144. border-radius: 6px;
  145. padding: 0 5px;
  146. }
  147. .markdown :where(h1, h2, h3, h4, h5, h6) code {
  148. font: inherit;
  149. font-family: var(--ds-font-family-code);
  150. }
  151. .markdown :global(.katex-display) {
  152. max-width: 100%;
  153. overflow-x: auto;
  154. overflow-y: hidden;
  155. }
  156. .markdown input[type='checkbox'] {
  157. margin: 0 8px 0 0;
  158. accent-color: var(--dsw-alias-label-secondary);
  159. }
  160. .tableScroll {
  161. max-width: 100%;
  162. overflow-x: auto;
  163. overscroll-behavior-x: contain;
  164. }
  165. /* Wide tables reveal their horizontal bar on hover (or keyboard focus)
  166. instead of keeping it painted. Chromium never repaints state-conditioned
  167. scrollbar STYLES (neither hover-conditioned `::-webkit-scrollbar*` rules
  168. nor a :hover `scrollbar-color` change reaches the painted bar), so the
  169. toggle is `overflow-x` itself — a layout change repaints reliably. The
  170. resting padding matches the themed bar's height on the WebKit scrollbar
  171. path. There, `scroll` reserves that height even when the table fits.
  172. Other engines and overlay scrollbars may reserve a different height.
  173. Wheel and trackpad scrolling need the pointer over the table, which is
  174. already the hover that re-enables scrolling. */
  175. .tableScroll:global(.md-table-wide) {
  176. overflow-x: hidden;
  177. padding-bottom: var(--dsh-scrollbar-width, 8px);
  178. }
  179. .tableScroll:global(.md-table-wide):hover,
  180. .tableScroll:global(.md-table-wide):focus-visible {
  181. overflow-x: scroll;
  182. padding-bottom: 0;
  183. }
  184. /* Chromium keyboard-focuses scrollable containers by default; the ring uses
  185. the sheet's link focus color. */
  186. .tableScroll:focus-visible {
  187. outline: none;
  188. box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary);
  189. }
  190. /* Many-column tables (the renderer's `md-table-wide` hook) keep their
  191. natural width and scroll inside the wrapper; a hosting layout may widen
  192. the wrapper through the hook (deepsuite chat TableWrapper parity). */
  193. .tableScroll table {
  194. border-collapse: collapse;
  195. width: max-content;
  196. max-width: max-content;
  197. }
  198. /* Tables under four columns, and any table inside a blockquote, fill the
  199. column instead: cells wrap down to their minimum readable width, and the
  200. wrapper's scroll only remains for the below-floor case (deepsuite chat
  201. parity: `.wrapper:not(:has(th:nth-child(4), td:nth-child(4)))`). */
  202. .tableFill table {
  203. width: 100%;
  204. max-width: none;
  205. }
  206. .tableScroll th {
  207. text-align: start;
  208. padding: 10px 16px;
  209. border-bottom: 0.5px solid var(--dsw-alias-border-l3);
  210. border-top: none;
  211. font: var(--dsw-font-markdown-table-head);
  212. max-width: 320px;
  213. max-width: min(30vw, 320px);
  214. min-width: 100px;
  215. }
  216. .tableScroll td {
  217. padding: 10px 16px;
  218. border-bottom: 0.5px solid var(--dsw-alias-border-l2);
  219. font: var(--dsw-font-markdown-table);
  220. max-width: 320px;
  221. max-width: min(30vw, 320px);
  222. min-width: 100px;
  223. }
  224. .tableScroll th:first-child,
  225. .tableScroll td:first-child {
  226. padding-left: 0;
  227. }
  228. .tableScroll td:last-child {
  229. padding-right: 0;
  230. }
  231. .tableScroll table code {
  232. font-size: 11px;
  233. }
  234. .markdown > *:first-child,
  235. .markdown p:first-child {
  236. margin-top: 0 !important;
  237. }
  238. .markdown > *:last-child,
  239. .markdown p:last-child {
  240. margin-bottom: 0 !important;
  241. }
  242. .imageAlt {
  243. color: var(--dsw-alias-label-tertiary);
  244. font-style: italic;
  245. }
  246. .image {
  247. display: block;
  248. width: auto;
  249. max-width: 100%;
  250. height: auto;
  251. margin: 0;
  252. border-radius: 8px;
  253. background: var(--dsw-alias-bg-base);
  254. object-fit: contain;
  255. }
  256. /* Inline file mention: the same link language this sheet gives anchors (and
  257. thereby URL-promoted inline code) — link-blue at rest, dotted underline only
  258. on hover/focus. An underline at rest reads badly inside the code chip, where
  259. it collides with monospace descenders and the pill background. */
  260. .fileMention {
  261. margin: 0;
  262. padding: 0;
  263. border: none;
  264. background: none;
  265. font: inherit;
  266. font-weight: 500;
  267. color: var(--dsw-alias-link);
  268. text-decoration: none;
  269. cursor: pointer;
  270. }
  271. .fileLink {
  272. max-width: 100%;
  273. text-align: inherit;
  274. }
  275. .fileMention:hover,
  276. .fileMention:focus {
  277. outline: none;
  278. text-decoration: underline dotted var(--dsw-alias-link);
  279. text-underline-offset: 3px;
  280. }
  281. .compact {
  282. max-width: 100%;
  283. font-size: var(--dsh-content-font-size-secondary, 13px);
  284. line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
  285. color: var(--dsw-alias-label-tertiary);
  286. }
  287. .compact :is(h1, h2, h3, h4, h5, h6) {
  288. margin: 8px 0 4px;
  289. font: inherit;
  290. font-weight: 600;
  291. color: inherit;
  292. }
  293. .compact :is(p, ul, ol, blockquote) {
  294. margin: 4px 0;
  295. }
  296. .compact li:not(:first-child) {
  297. margin-top: 2px;
  298. }
  299. .compact li > p {
  300. margin: 4px 0;
  301. }
  302. .compact li::marker {
  303. line-height: inherit;
  304. color: inherit;
  305. }
  306. .compact blockquote {
  307. padding-left: 8px;
  308. }
  309. .compact hr {
  310. margin: 8px 0;
  311. }
  312. .compact a,
  313. .compact .fileMention {
  314. font-weight: inherit;
  315. color: inherit;
  316. text-decoration: underline dotted;
  317. }
  318. .compact a:hover,
  319. .compact a:focus,
  320. .compact .fileMention:hover,
  321. .compact .fileMention:focus {
  322. text-decoration-color: currentColor;
  323. }
  324. .compact :not(pre) > code {
  325. display: inline;
  326. font: inherit;
  327. font-family: var(--ds-font-family-code);
  328. font-size: 1em !important;
  329. border-radius: 4px;
  330. padding: 0 3px;
  331. box-decoration-break: clone;
  332. }
  333. .markdown.compact :global(.md-code-block) {
  334. margin: 4px 0;
  335. color: inherit;
  336. }
  337. .compact :global(.md-code-block) > :has(> [data-code-block-banner]) {
  338. position: static;
  339. z-index: auto;
  340. }
  341. .compact [data-code-block-banner] {
  342. padding: 4px 8px;
  343. font: inherit;
  344. }
  345. .compact [data-code-block-banner] > :first-child {
  346. font-size: inherit;
  347. line-height: inherit;
  348. color: inherit;
  349. }
  350. .compact pre {
  351. margin: 4px 0;
  352. padding: 8px;
  353. font-size: inherit;
  354. line-height: inherit;
  355. }
  356. /* Shiki writes token colors inline; compact code uses the surrounding text color. */
  357. .compact pre,
  358. .compact pre :is(code, span) {
  359. color: inherit !important;
  360. }
  361. .markdown.compact .tableScroll {
  362. width: 100%;
  363. max-width: 100%;
  364. margin: 4px 0;
  365. padding-left: 0;
  366. }
  367. .markdown.compact .tableScroll > table {
  368. z-index: auto;
  369. }
  370. .compact :is(th, td) {
  371. padding: 4px 8px;
  372. font: inherit;
  373. }
  374. .compact th {
  375. font-weight: 600;
  376. }
  377. .compact :global(.katex) {
  378. font-size: 1em;
  379. }
  380. /* Keep KaTeX's inline baseline and scroll the containing block only when needed. */
  381. .compact :is(p, h1, h2, h3, h4, h5, h6, ul, ol):has(:global(.katex)) {
  382. overflow-x: auto;
  383. overflow-y: hidden;
  384. /* KaTeX descenders can paint one pixel below a fractional line-box edge. */
  385. padding-bottom: 1px;
  386. }
  387. .compact :global(.katex-display) {
  388. margin: 4px 0;
  389. }