typography.config.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /**
  2. * Typography customization for @tailwindcss/typography.
  3. *
  4. * Loaded via `@config './typography.config.js'` in tailwind.config.css.
  5. * Only contains theme.extend.typography — everything else (colors, animations,
  6. * variants, utilities, base) lives in CSS under packages/config/css/.
  7. *
  8. * The typography plugin reads theme.typography to generate .prose, .prose-toc,
  9. * and .prose-docs classes (and to make them @apply-able). See:
  10. * https://github.com/tailwindlabs/tailwindcss-typography#customizing-the-css
  11. */
  12. module.exports = {
  13. theme: {
  14. extend: {
  15. typography: {
  16. DEFAULT: {
  17. css: {
  18. // Removal of backticks in code blocks.
  19. // https://github.com/tailwindlabs/tailwindcss-typography/issues/135
  20. 'code::before': { content: '""' },
  21. 'code::after': { content: '""' },
  22. '--tw-prose-body': 'hsl(var(--foreground-light))',
  23. '--tw-prose-headings': 'hsl(var(--foreground-default))',
  24. '--tw-prose-lead': 'hsl(var(--foreground-light))',
  25. '--tw-prose-links': 'hsl(var(--foreground-light))',
  26. '--tw-prose-bold': 'hsl(var(--foreground-light))',
  27. '--tw-prose-counters': 'hsl(var(--foreground-light))',
  28. '--tw-prose-bullets': 'hsl(var(--foreground-muted))',
  29. '--tw-prose-hr': 'hsl(var(--background-surface-300))',
  30. '--tw-prose-quotes': 'hsl(var(--foreground-light))',
  31. '--tw-prose-quote-borders': 'hsl(var(--background-surface-300))',
  32. '--tw-prose-captions': 'hsl(var(--border-strong))',
  33. '--tw-prose-code': 'hsl(var(--foreground-default))',
  34. '--tw-prose-pre-code': 'hsl(var(--foreground-muted))',
  35. '--tw-prose-pre-bg': 'hsl(var(--background-surface-200))',
  36. '--tw-prose-th-borders': 'hsl(var(--background-surface-300))',
  37. '--tw-prose-td-borders': 'hsl(var(--background-default))',
  38. '--tw-prose-invert-body': 'hsl(var(--background-default))',
  39. '--tw-prose-invert-headings': 'white',
  40. '--tw-prose-invert-lead': 'hsl(var(--background-surface-300))',
  41. '--tw-prose-invert-links': 'white',
  42. '--tw-prose-invert-bold': 'white',
  43. '--tw-prose-invert-counters': 'hsl(var(--background-surface-200))',
  44. '--tw-prose-invert-bullets': 'hsl(var(--background-selection))',
  45. '--tw-prose-invert-hr': 'hsl(var(--border-strong))',
  46. '--tw-prose-invert-quotes': 'hsl(var(--background-alternative-default))',
  47. '--tw-prose-invert-quote-borders': 'hsl(var(--border-strong))',
  48. '--tw-prose-invert-captions': 'hsl(var(--background-surface-200))',
  49. h4: { fontSize: '1.15em' },
  50. // h5 isn't included in --tw-prose-headings.
  51. h5: { color: 'var(--color-scale-1200)' },
  52. 'h1, h2, h3, h4, h5, h6': { fontWeight: '400' },
  53. 'article h2, article h3, article h4, article h5, article h6': {
  54. marginTop: '2em',
  55. marginBottom: '1em',
  56. },
  57. p: { fontWeight: '400' },
  58. strong: { fontWeight: '500' },
  59. pre: {
  60. background: 'none',
  61. padding: 0,
  62. marginBottom: '32px',
  63. },
  64. ul: {
  65. listStyleType: 'none',
  66. paddingLeft: '1rem',
  67. },
  68. 'ul li': { position: 'relative' },
  69. 'ul li::before': {
  70. position: 'absolute',
  71. top: '0.75rem',
  72. left: '-1rem',
  73. height: '0.125rem',
  74. width: '0.5rem',
  75. borderRadius: '0.25rem',
  76. backgroundColor: 'hsl(var(--border-strong))',
  77. content: '""',
  78. },
  79. ol: {
  80. paddingLeft: '1rem',
  81. counterReset: 'item',
  82. listStyleType: 'none',
  83. marginBottom: '3rem',
  84. },
  85. 'ol>li': {
  86. display: 'block',
  87. position: 'relative',
  88. paddingLeft: '1rem',
  89. },
  90. 'ol>li::before': {
  91. position: 'absolute',
  92. top: '0.25rem',
  93. left: '-1rem',
  94. height: '1.2rem',
  95. width: '1.2rem',
  96. borderRadius: '0.25rem',
  97. backgroundColor: 'hsl(var(--background-surface-100))',
  98. border: '1px solid hsl(var(--border-default))',
  99. content: 'counter(item) " "',
  100. counterIncrement: 'item',
  101. fontSize: '12px',
  102. color: 'hsl(var(--foreground-muted))',
  103. display: 'flex',
  104. alignItems: 'center',
  105. justifyContent: 'center',
  106. },
  107. 'p img': {
  108. border: '1px solid hsl(var(--border-muted))',
  109. borderRadius: '4px',
  110. overflow: 'hidden',
  111. },
  112. iframe: {
  113. border: '1px solid hsl(var(--border-default))',
  114. borderRadius: 'var(--radius-lg)',
  115. },
  116. td: {
  117. borderBottom: '1px solid hsl(var(--background-surface-200))',
  118. },
  119. code: {
  120. fontWeight: '400',
  121. padding: '0.2rem 0.4rem',
  122. backgroundColor: 'hsl(var(--background-surface-200))',
  123. border: '1px solid hsl(var(--background-surface-300))',
  124. borderRadius: 'var(--radius-lg)',
  125. },
  126. a: {
  127. position: 'relative',
  128. transition: 'all 0.18s ease',
  129. paddingBottom: '2px',
  130. fontWeight: '400',
  131. opacity: 1,
  132. color: 'hsl(var(--foreground-default))',
  133. textDecorationLine: 'underline',
  134. textDecorationColor: 'hsl(var(--foreground-muted))',
  135. textDecorationThickness: '1px',
  136. textUnderlineOffset: '2px',
  137. },
  138. 'a:hover': {
  139. textDecorationColor: 'hsl(var(--foreground-default))',
  140. },
  141. figcaption: {
  142. color: 'hsl(var(--foreground-muted))',
  143. fontFamily: 'Office Code Pro, monospace',
  144. },
  145. 'figure.quote-figure p:first-child': {
  146. marginTop: '0 !important',
  147. },
  148. 'figure.quote-figure p:last-child': {
  149. marginBottom: '0 !important',
  150. },
  151. figure: { margin: '3rem 0' },
  152. 'figure img': { margin: '0 !important' },
  153. },
  154. },
  155. toc: {
  156. css: {
  157. ul: {
  158. 'list-style-type': 'none',
  159. 'padding-left': 0,
  160. margin: 0,
  161. li: { 'padding-left': 0 },
  162. a: {
  163. display: 'block',
  164. marginBottom: '0.4rem',
  165. 'text-decoration': 'none',
  166. fontSize: '0.8rem',
  167. fontWeight: '200',
  168. color: 'hsl(var(--foreground-light))',
  169. '&:hover': {
  170. color: 'hsl(var(--foreground-default))',
  171. },
  172. 'font-weight': '400',
  173. },
  174. ul: {
  175. 'list-style-type': 'none',
  176. li: {
  177. marginTop: '0.2rem',
  178. marginBottom: '0.2rem',
  179. 'padding-left': '0 !important',
  180. 'margin-left': '0.5rem',
  181. },
  182. a: {
  183. fontWeight: '200',
  184. color: 'hsl(var(--foreground-lighter))',
  185. '&:hover': {
  186. color: 'hsl(var(--foreground-default))',
  187. },
  188. },
  189. },
  190. },
  191. },
  192. },
  193. // Used in docs and changelog content.
  194. docs: {
  195. css: {
  196. '--tw-prose-body': 'hsl(var(--foreground-light))',
  197. '--tw-prose-headings': 'hsl(var(--foreground-default))',
  198. '--tw-prose-lead': 'hsl(var(--foreground-light))',
  199. '--tw-prose-links': 'hsl(var(--brand-500))',
  200. '--tw-prose-bold': 'hsl(var(--foreground-light))',
  201. '--tw-prose-counters': 'hsl(var(--foreground-light))',
  202. '--tw-prose-bullets': 'hsl(var(--foreground-muted))',
  203. '--tw-prose-hr': 'hsl(var(--background-surface-300))',
  204. '--tw-prose-quotes': 'hsl(var(--foreground-light))',
  205. '--tw-prose-quote-borders': 'hsl(var(--background-surface-300))',
  206. '--tw-prose-captions': 'hsl(var(--border-strong))',
  207. '--tw-prose-code': 'hsl(var(--foreground-default))',
  208. '--tw-prose-pre-code': 'hsl(var(--foreground-muted))',
  209. '--tw-prose-pre-bg': 'hsl(var(--background-surface-200))',
  210. '--tw-prose-th-borders': 'hsl(var(--background-surface-300))',
  211. '--tw-prose-td-borders': 'hsl(var(--background-default))',
  212. '--tw-prose-invert-body': 'hsl(var(--background-default))',
  213. '--tw-prose-invert-headings': 'white',
  214. '--tw-prose-invert-lead': 'hsl(var(--background-surface-300))',
  215. '--tw-prose-invert-links': 'white',
  216. '--tw-prose-invert-bold': 'white',
  217. '--tw-prose-invert-counters': 'hsl(var(--background-surface-200))',
  218. '--tw-prose-invert-bullets': 'hsl(var(--background-selection))',
  219. '--tw-prose-invert-hr': 'hsl(var(--border-strong))',
  220. '--tw-prose-invert-quotes': 'hsl(var(--background-alternative-default))',
  221. '--tw-prose-invert-quote-borders': 'hsl(var(--border-strong))',
  222. '--tw-prose-invert-captions': 'hsl(var(--background-surface-200))',
  223. 'h1, h2, h3, h4, h5': { fontWeight: '400' },
  224. },
  225. },
  226. },
  227. },
  228. },
  229. }