Skip to content

Commit 58e7069

Browse files
committed
Add description list (<dl>, <dt>, '<dd>') styles
1 parent 2ca7f49 commit 58e7069

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

demo/components/MarkdownSample.mdx

+23
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,29 @@ The most annoying thing about lists in Markdown is that `<li>` elements aren't g
161161

162162
And finally a sentence to close off this section.
163163

164+
## We didn't forget about description lists
165+
166+
Well, that's not exactly true, we first released this plugin back in 2020 and it took three years before we added description lists. But they're here now, so let's just be happy about that&hellip;okay? They can be great for things like FAQs.
167+
168+
<dl>
169+
<dt>Why do you never see elephants hiding in trees?</dt>
170+
<dd>
171+
Because they're so good at it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas
172+
cupiditate laboriosam fugiat.
173+
</dd>
174+
<dt>What do you call someone with no body and no nose?</dt>
175+
<dd>
176+
Nobody knows. Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, voluptas ipsa quia
177+
excepturi, quibusdam natus exercitationem sapiente tempore labore voluptatem.
178+
</dd>
179+
<dt>Why can't you hear a pterodactyl go to the bathroom?</dt>
180+
<dd>
181+
Because the pee is silent. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam, quas
182+
voluptatibus ex culpa ipsum, aspernatur blanditiis fugiat ullam magnam suscipit deserunt illum
183+
natus facilis atque vero consequatur! Quisquam, debitis error.
184+
</dd>
185+
</dl>
186+
164187
## There are other elements we need to style
165188

166189
I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.

src/styles.js

+59
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ let defaultModifiers = {
133133
marginTop: em(8, 14),
134134
marginBottom: em(8, 14),
135135
},
136+
dl: {
137+
marginTop: em(16, 14),
138+
marginBottom: em(16, 14),
139+
},
140+
dt: {
141+
marginTop: em(16, 14),
142+
},
143+
dd: {
144+
marginTop: em(4, 14),
145+
paddingLeft: em(22, 14),
146+
},
136147
hr: {
137148
marginTop: em(40, 14),
138149
marginBottom: em(40, 14),
@@ -311,6 +322,17 @@ let defaultModifiers = {
311322
marginTop: em(12, 16),
312323
marginBottom: em(12, 16),
313324
},
325+
dl: {
326+
marginTop: em(20, 16),
327+
marginBottom: em(20, 16),
328+
},
329+
dt: {
330+
marginTop: em(20, 16),
331+
},
332+
dd: {
333+
marginTop: em(8, 16),
334+
paddingLeft: em(26, 16),
335+
},
314336
hr: {
315337
marginTop: em(48, 16),
316338
marginBottom: em(48, 16),
@@ -489,6 +511,17 @@ let defaultModifiers = {
489511
marginTop: em(16, 18),
490512
marginBottom: em(16, 18),
491513
},
514+
dl: {
515+
marginTop: em(24, 18),
516+
marginBottom: em(24, 18),
517+
},
518+
dt: {
519+
marginTop: em(24, 18),
520+
},
521+
dd: {
522+
marginTop: em(12, 18),
523+
paddingLeft: em(28, 18),
524+
},
492525
hr: {
493526
marginTop: em(56, 18),
494527
marginBottom: em(56, 18),
@@ -667,6 +700,17 @@ let defaultModifiers = {
667700
marginTop: em(16, 20),
668701
marginBottom: em(16, 20),
669702
},
703+
dl: {
704+
marginTop: em(24, 20),
705+
marginBottom: em(24, 20),
706+
},
707+
dt: {
708+
marginTop: em(24, 20),
709+
},
710+
dd: {
711+
marginTop: em(12, 20),
712+
paddingLeft: em(32, 20),
713+
},
670714
hr: {
671715
marginTop: em(56, 20),
672716
marginBottom: em(56, 20),
@@ -845,6 +889,17 @@ let defaultModifiers = {
845889
marginTop: em(16, 24),
846890
marginBottom: em(16, 24),
847891
},
892+
dl: {
893+
marginTop: em(32, 24),
894+
marginBottom: em(32, 24),
895+
},
896+
dt: {
897+
marginTop: em(32, 24),
898+
},
899+
dd: {
900+
marginTop: em(12, 24),
901+
paddingLeft: em(38, 24),
902+
},
848903
hr: {
849904
marginTop: em(72, 24),
850905
marginBottom: em(72, 24),
@@ -1300,6 +1355,10 @@ module.exports = {
13001355
'ul > li::marker': {
13011356
color: 'var(--tw-prose-bullets)',
13021357
},
1358+
dt: {
1359+
color: 'var(--tw-prose-headings)',
1360+
fontWeight: '600',
1361+
},
13031362
hr: {
13041363
borderColor: 'var(--tw-prose-hr)',
13051364
borderTopWidth: 1,

0 commit comments

Comments
 (0)