MarkdownText.module.css 10 KB

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