Skip to content

Commit 0151e03

Browse files
committed
Rewrite sample content
1 parent 209bbcd commit 0151e03

File tree

1 file changed

+52
-63
lines changed

1 file changed

+52
-63
lines changed

docs/components/MarkdownSample.mdx

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,57 @@
33
[View on GitHub](https://github.com/tailwindcss/typography)
44

55
<p className="lead">
6-
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown
7-
printer took a galley of type and scrambled it to make a type specimen book.
6+
Until now, trying to style an article, document, or blog post with Tailwind has been a tedious
7+
task that required a keen eye for typography and a lot of complex custom CSS.
88
</p>
99

10-
A plugin that provides a `rich-text` class you can use to add sensible typographic defaults to any vanilla HTML you don't control (like HTML rendered from Markdown, or pulled from a CMS).
10+
By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
11+
12+
We get lots of complaints about it actually, with people regularly asking us things like:
13+
14+
> Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
15+
16+
We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
17+
18+
The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downside of doing something stupid like disabling our base styles.
19+
20+
It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
1121

1222
```html
13-
<div class="rich-text">
14-
{{ markdown }}
15-
</div>
23+
<article class="prose">
24+
<h1>Garlic bread with cheese: What the science tells us</h1>
25+
<p>
26+
For years parents have espoused the health benefits of eating garlic bread with cheese to their
27+
children, with the food earning such an iconic status in our culture that kids will often dress
28+
up as warm, cheesy loaf for Halloween.
29+
</p>
30+
<p>
31+
But a recent study shows that the celebrated appetizer may be linked to a series of rabies cases
32+
springing up around the country.
33+
</p>
34+
<!-- ... -->
35+
</article>
1636
```
1737

18-
What follows is just a big block of example content designed to dogfood the plugin.
38+
For more information about how to use the plugin and the features it includes, [read the documentation](#).
1939

2040
---
2141

22-
It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
42+
## What to expect from here on out
43+
44+
What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
2345

2446
It's important to cover all of these use cases for a few reasons:
2547

2648
1. We want everything to look good out of the box.
2749
2. Really just the first reason, that's the whole point of the plugin.
28-
3. Here's a third pretend reason though because three is a better number of items.
50+
3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
2951

30-
Now we're going to try out a header style.
52+
Now we're going to try out another header style.
3153

32-
---
54+
### Typography should be easy
3355

34-
## Typography should be easy
35-
36-
So that's a header for you — with any luck by the time I'm done writing this plugin that will look pretty reasonable.
56+
So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
3757

3858
Something a wise person once told me about typography is:
3959

@@ -58,102 +78,69 @@ Now I'm going to show you an example of an unordered list to make sure that look
5878
- In this example we're keeping the items short.
5979
- Later, we'll use longer, more complex list items.
6080

61-
It's also possible to have an ordered list with _lots_ of items in it. I think more than maybe 25 is probably not worth optimizing for but let's at least try 25 to see how it looks.
62-
63-
1. Here's the first item.
64-
2. Now a second item has appeared.
65-
3. A third item could also be in this list.
66-
4. If we added fourth it would go here.
67-
5. Five is the number of fingers most people have on each hand.
68-
6. Six.
69-
7. Seven is a great name for a baby.
70-
8. Eight is the number of the black ball in pool.
71-
9. Nine is one of my favorite numbers because I like 3 and 9 has three 3s.
72-
10. This is the number my daughter normally stops counting at.
73-
11. Add a seven before this one and you've got a great convenience store.
74-
12. Monkeys.
75-
13. Some elevators don't have this number, maybe most even?
76-
14. Now we are entering the territory where numbers don't have any cool meaning.
77-
15. Yep still holding true.
78-
16. You could learn to drive now in many places.
79-
17. At this point you should be pretty good at driving.
80-
18. Not old enough to drink but old enough to play bingo.
81-
19. Now you can booze up baby.
82-
20. Still not old enough to drink in the US though.
83-
21. But now you can.
84-
22. You've probably gotten a DUI at this point.
85-
23. And now you're in jail.
86-
24. Still in jail.
87-
25. Now you could rent a car if you hadn't got a DUI.
88-
8981
And that's the end of this section.
9082

9183
## What if we stack headings?
9284

9385
### We should make sure that looks good, too.
9486

95-
Sometimes you have headings directly underneath each other. In those cases you have to be careful not to use too much margin, because typically the space you need between a heading and a paragraph is more than you want between two headings.
87+
Sometimes you have headings directly underneath each other. In those cases you have often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
9688

97-
### Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
89+
### When a heading comes after a paragraph...
9890

9991
When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
10092

10193
- **I often do this thing where list items have headings.**
10294

10395
For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
10496

105-
I often have two or three paragraphs in these list items too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense.
106-
107-
Pretty tough honestly.
97+
I often have two or three paragraphs in these list items too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
10898

10999
- **Since this is a list, I need at least two items.**
110100

111-
I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic.
112-
113-
That's why I've added this second list item so I actually have something to look at when writing the styles.
101+
I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
114102

115103
- **It's not a bad idea to add a third item either.**
116104

117105
I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
118106

119-
With any luck this will make it even easier for me to get the styles right.
120-
121107
After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
122108

123109
## Code should look okay by default.
124110

125-
I think most people are going to use highlight.js or Prism or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
111+
I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
126112

127-
Here's the Tailwind config file for this docs site:
113+
Here's what a default `tailwind.config.js` file looks like at the time of writing:
128114

129115
```js
130116
module.exports = {
117+
purge: [],
131118
theme: {
132119
extend: {},
133120
},
134121
variants: {},
135-
plugins: [require('../src/index.js')],
122+
plugins: [],
136123
}
137124
```
138125

139126
Hopefully that looks good enough to you.
140127

141128
### What about nested lists?
142129

143-
Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it I have to carry the burden of at least making it work.
130+
Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
144131

145132
1. **Nested lists are rarely a good idea.**
146133
- You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
147134
- Nested navigation in UIs is a bad idea too, keep things as flat as possible.
148135
- Nesting tons of folders in your source code is also not helpful.
149136
2. **Since we need to have more items, here's another one.**
150-
- I'm not sure if I'll bother styling more than two levels deep.
137+
- I'm not sure if we'll bother styling more than two levels deep.
151138
- Two is already too much, three is guaranteed to be a bad idea.
152139
- If you nest four levels deep you belong in prison.
153140
3. **Two items isn't really a list, three is good though.**
154141
- Again please don't nest lists if you want people to actually read your content.
155142
- Nobody wants to look at this.
156-
- I'm upset that I even have to bother styling this.
143+
- I'm upset that we even have to bother styling this.
157144

158145
The most annoying thing about lists in Markdown is that `<li>` elements aren't given a child `<p>` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
159146

@@ -178,21 +165,23 @@ The most annoying thing about lists in Markdown is that `<li>` elements aren't g
178165

179166
And finally a sentence to close off this section.
180167

181-
## There are other `elements` we need to style
168+
## There are other elements we need to style
182169

183-
I almost forgot to style links, like [this link to the Tailwind CSS website](https://tailwindcss.com). How should those look by default, blue I guess? I dunno.
170+
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.
184171

185172
We also need to make sure inline code looks good, like if I wanted to talk about `<span>` elements or tell you the good news about `@tailwindcss/typography`.
186173

187174
### Sometimes I even use `code` in headings
188175

189-
Even though it's probably a bad idea, and I tend to have a hard time making it look good.
176+
Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in tildes"_ trick works pretty well though really.
190177

191-
Another thing I've done in the past is make some code a link, like if I wanted to tell you about [`@tailwindcss/custom-forms`](https://github.com/tailwindcss/custom-forms), a useful plugin for making it easier to style form elements in your Tailwind projects.
178+
Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the tildes but it is absolutely not worth the madness it would require to avoid it.
192179

193180
#### We haven't used an `h4` yet
194181

195-
But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason you animals.
182+
But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
183+
184+
We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
196185

197186
### We still need to think about stacked headings though.
198187

0 commit comments

Comments
 (0)