-
Notifications
You must be signed in to change notification settings - Fork 14
/
tailwind.typography.config.ts
123 lines (119 loc) · 3.38 KB
/
tailwind.typography.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* eslint-disable*/
const colors = require('tailwindcss/colors')
const round = (num: number) =>
num
.toFixed(7)
.replace(/(\.[0-9]+?)0+$/, '$1')
.replace(/\.0$/, '')
const rem = (px: number) => `${round(px / 16)}rem`
const em = (px: number, base: number) => `${round(px / base)}em`
const hexToRgb = (hex: string) => {
hex = hex.replace('#', '')
hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex
const r = parseInt(hex.substring(0, 2), 16)
const g = parseInt(hex.substring(2, 4), 16)
const b = parseInt(hex.substring(4, 6), 16)
return `${r} ${g} ${b}`
}
/** @type {import('tailwindcss').Config} */
module.exports = {
theme: {
extend: {
typography: () => ({
DEFAULT: {
css: {
// fontSize: '14rem',
pre: {
// fontSize: em(14, 16),
// lineHeight: round(24 / 14),
// marginTop: em(24, 14),
marginBottom: 0,
borderRadius: 0,
paddingTop: 0,
paddingInlineEnd: 0,
paddingBottom: 0,
paddingInlineStart: 0,
// color: 'var(--tw-prose-pre-code)',
backgroundColor: 'initial',
// overflowX: 'auto',
fontWeight: 'initial',
},
code: {
backgroundColor: colors.zinc['100'],
paddingInlineStart: em(4, 16),
paddingInlineEnd: em(4, 16),
paddingTop: em(2, 16),
paddingBottom: em(2, 16),
borderRadius: rem(2),
},
'code::before': {
content: '',
},
'code::after': {
content: '',
},
ol: {
marginTop: 0,
marginBottom: 0,
paddingInlineStart: em(18, 16),
},
ul: {
marginTop: 24,
marginBottom: 24,
paddingInlineStart: em(18, 16),
},
li: {
marginTop: 0,
marginBottom: 0,
},
'ol > li': {
paddingInlineStart: em(6, 16),
},
'ul > li': {
paddingInlineStart: em(6, 16),
},
'> ul > li p': {
marginTop: em(12, 16),
marginBottom: em(12, 16),
},
'> ul > li > p:first-child': {
marginTop: 24,
},
'> ul > li > p:last-child': {
marginBottom: 24,
},
'> ol > li > p:first-child': {
marginTop: 24,
},
'> ol > li > p:last-child': {
marginBottom: 24,
},
'ul ul, ul ol, ol ul, ol ol': {
marginTop: em(12, 16),
marginBottom: em(12, 16),
},
dl: {
marginTop: 24,
marginBottom: 24,
},
dt: {
marginTop: 24,
},
dd: {
marginTop: em(8, 16),
paddingInlineStart: em(18, 16),
},
},
},
zinc: {
css: {
'--tw-prose-counters': colors.zinc['950'],
'--tw-prose-bullets': colors.zinc['950'],
'--tw-prose-code': colors.pink['600'],
},
},
}),
},
},
plugins: [require('@tailwindcss/typography')],
}