Skip to content

Commit 6ec8568

Browse files
committed
feat: add unocss typography plugin for prose styling
1 parent 1b253b2 commit 6ec8568

4 files changed

Lines changed: 307 additions & 5 deletions

File tree

TODOs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Current
88

99
- Blog list UI - fix posts width
10-
- Blog post UI
10+
- Blog post UI - (Started - needs more polish)
1111
- OAuth
1212
- Standard site push - Mock PDS push for now
1313
- anthony's alternative markdown solution for now and Nuxt content integration for later
@@ -23,7 +23,7 @@
2323
## Completed
2424

2525
- [x] Lexicons
26-
- [x] x
26+
- [x] Prose-styling using unocss typography
2727
- [x] x
2828

2929
---

app/pages/blog/[slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ useSeoMeta({
2222
<div class="">I AM A WEAK HEADER</div>
2323
</header>
2424

25-
<article v-if="post">
25+
<article v-if="post" class="mx-auto text-base prose dark:prose-invert text-lg">
2626
<ContentRenderer v-if="post" :value="post" />
2727
</article>
2828

content/blog/first-post.md

Lines changed: 302 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,306 @@ description: 'My first post on the blog'
99
draft: false
1010
---
1111

12-
# My First Page
12+
# Markdown: Syntax
1313

14-
Here is some content.
14+
- [Overview](#overview)
15+
- [Philosophy](#philosophy)
16+
- [Block Elements](#block-elements)
17+
- [Paragraphs and Line Breaks](#paragraphs-and-line-breaks)
18+
- [Headers](#headers)
19+
- [Blockquotes](#blockquotes)
20+
- [Lists](#lists)
21+
- [Code Blocks](#code-blocks)
22+
- [Span Elements](#span-elements)
23+
- [Links](#links)
24+
- [Emphasis](#emphasis)
25+
- [Code](#code)
26+
27+
**Note:** This document is itself written using Markdown; you
28+
can [see the source for it by adding '.text' to the URL](/projects/markdown/syntax.text).
29+
30+
---
31+
32+
## Overview
33+
34+
### Philosophy
35+
36+
Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
37+
38+
Readability, however, is emphasized above all else. A Markdown-formatted
39+
document should be publishable as-is, as plain text, without looking
40+
like it's been marked up with tags or formatting instructions. While
41+
Markdown's syntax has been influenced by several existing text-to-HTML
42+
filters -- including [Setext](http://docutils.sourceforge.net/mirror/setext.html), [atx](http://www.aaronsw.com/2002/atx/), [Textile](http://textism.com/tools/textile/), [reStructuredText](http://docutils.sourceforge.net/rst.html),
43+
[Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) -- the single biggest source of
44+
inspiration for Markdown's syntax is the format of plain text email.
45+
46+
## Block Elements
47+
48+
### Paragraphs and Line Breaks
49+
50+
A paragraph is simply one or more consecutive lines of text, separated
51+
by one or more blank lines. (A blank line is any line that looks like a
52+
blank line -- a line containing nothing but spaces or tabs is considered
53+
blank.) Normal paragraphs should not be indented with spaces or tabs.
54+
55+
The implication of the "one or more consecutive lines of text" rule is
56+
that Markdown supports "hard-wrapped" text paragraphs. This differs
57+
significantly from most other text-to-HTML formatters (including Movable
58+
Type's "Convert Line Breaks" option) which translate every line break
59+
character in a paragraph into a `<br />` tag.
60+
61+
When you _do_ want to insert a `<br />` break tag using Markdown, you
62+
end a line with two or more spaces, then type return.
63+
64+
### Headers
65+
66+
Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
67+
68+
Optionally, you may "close" atx-style headers. This is purely
69+
cosmetic -- you can use this if you think it looks better. The
70+
closing hashes don't even need to match the number of hashes
71+
used to open the header. (The number of opening hashes
72+
determines the header level.)
73+
74+
### Blockquotes
75+
76+
Markdown uses email-style `>` characters for blockquoting. If you're
77+
familiar with quoting passages of text in an email message, then you
78+
know how to create a blockquote in Markdown. It looks best if you hard
79+
wrap the text and put a `>` before every line:
80+
81+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
82+
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
83+
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
84+
>
85+
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
86+
> id sem consectetuer libero luctus adipiscing.
87+
88+
Markdown allows you to be lazy and only put the `>` before the first
89+
line of a hard-wrapped paragraph:
90+
91+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
92+
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
93+
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
94+
95+
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
96+
> id sem consectetuer libero luctus adipiscing.
97+
98+
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
99+
adding additional levels of `>`:
100+
101+
> This is the first level of quoting.
102+
>
103+
> > This is nested blockquote.
104+
>
105+
> Back to the first level.
106+
107+
Blockquotes can contain other Markdown elements, including headers, lists,
108+
and code blocks:
109+
110+
> ## This is a header.
111+
>
112+
> 1. This is the first list item.
113+
> 2. This is the second list item.
114+
>
115+
> Here's some example code:
116+
>
117+
> return shell_exec("echo $input | $markdown_script");
118+
119+
Any decent text editor should make email-style quoting easy. For
120+
example, with BBEdit, you can make a selection and choose Increase
121+
Quote Level from the Text menu.
122+
123+
### Lists
124+
125+
Markdown supports ordered (numbered) and unordered (bulleted) lists.
126+
127+
Unordered lists use asterisks, pluses, and hyphens -- interchangably
128+
-- as list markers:
129+
130+
- Red
131+
- Green
132+
- Blue
133+
134+
is equivalent to:
135+
136+
- Red
137+
- Green
138+
- Blue
139+
140+
and:
141+
142+
- Red
143+
- Green
144+
- Blue
145+
146+
Ordered lists use numbers followed by periods:
147+
148+
1. Bird
149+
2. McHale
150+
3. Parish
151+
152+
It's important to note that the actual numbers you use to mark the
153+
list have no effect on the HTML output Markdown produces. The HTML
154+
Markdown produces from the above list is:
155+
156+
If you instead wrote the list in Markdown like this:
157+
158+
1. Bird
159+
1. McHale
160+
1. Parish
161+
162+
or even:
163+
164+
3. Bird
165+
1. McHale
166+
1. Parish
167+
168+
you'd get the exact same HTML output. The point is, if you want to,
169+
you can use ordinal numbers in your ordered Markdown lists, so that
170+
the numbers in your source match the numbers in your published HTML.
171+
But if you want to be lazy, you don't have to.
172+
173+
To make lists look nice, you can wrap items with hanging indents:
174+
175+
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
176+
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
177+
viverra nec, fringilla in, laoreet vitae, risus.
178+
- Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
179+
Suspendisse id sem consectetuer libero luctus adipiscing.
180+
181+
But if you want to be lazy, you don't have to:
182+
183+
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
184+
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
185+
viverra nec, fringilla in, laoreet vitae, risus.
186+
- Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
187+
Suspendisse id sem consectetuer libero luctus adipiscing.
188+
189+
List items may consist of multiple paragraphs. Each subsequent
190+
paragraph in a list item must be indented by either 4 spaces
191+
or one tab:
192+
193+
1. This is a list item with two paragraphs. Lorem ipsum dolor
194+
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
195+
mi posuere lectus.
196+
197+
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
198+
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
199+
sit amet velit.
200+
201+
2. Suspendisse id sem consectetuer libero luctus adipiscing.
202+
203+
It looks nice if you indent every line of the subsequent
204+
paragraphs, but here again, Markdown will allow you to be
205+
lazy:
206+
207+
- This is a list item with two paragraphs.
208+
209+
This is the second paragraph in the list item. You're
210+
211+
only required to indent the first line. Lorem ipsum dolor
212+
sit amet, consectetuer adipiscing elit.
213+
214+
- Another item in the same list.
215+
216+
To put a blockquote within a list item, the blockquote's `>`
217+
delimiters need to be indented:
218+
219+
- A list item with a blockquote:
220+
221+
> This is a blockquote
222+
> inside a list item.
223+
224+
To put a code block within a list item, the code block needs
225+
to be indented _twice_ -- 8 spaces or two tabs:
226+
227+
- A list item with a code block:
228+
229+
<code goes here>
230+
231+
### Code Blocks
232+
233+
Pre-formatted code blocks are used for writing about programming or
234+
markup source code. Rather than forming normal paragraphs, the lines
235+
of a code block are interpreted literally. Markdown wraps a code block
236+
in both `<pre>` and `<code>` tags.
237+
238+
To produce a code block in Markdown, simply indent every line of the
239+
block by at least 4 spaces or 1 tab.
240+
241+
This is a normal paragraph:
242+
243+
This is a code block.
244+
245+
Here is an example of AppleScript:
246+
247+
tell application "Foo"
248+
beep
249+
end tell
250+
251+
A code block continues until it reaches a line that is not indented
252+
(or the end of the article).
253+
254+
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
255+
are automatically converted into HTML entities. This makes it very
256+
easy to include example HTML source code using Markdown -- just paste
257+
it and indent it, and Markdown will handle the hassle of encoding the
258+
ampersands and angle brackets. For example, this:
259+
260+
<div class="footer">
261+
&copy; 2004 Foo Corporation
262+
</div>
263+
264+
Regular Markdown syntax is not processed within code blocks. E.g.,
265+
asterisks are just literal asterisks within a code block. This means
266+
it's also easy to use Markdown to write about Markdown's own syntax.
267+
268+
```
269+
tell application "Foo"
270+
beep
271+
end tell
272+
```
273+
274+
## Span Elements
275+
276+
### Links
277+
278+
Markdown supports two style of links: _inline_ and _reference_.
279+
280+
In both styles, the link text is delimited by [square brackets].
281+
282+
To create an inline link, use a set of regular parentheses immediately
283+
after the link text's closing square bracket. Inside the parentheses,
284+
put the URL where you want the link to point, along with an _optional_
285+
title for the link, surrounded in quotes. For example:
286+
287+
This is [an example](http://example.com/) inline link.
288+
289+
[This link](http://example.net/) has no title attribute.
290+
291+
### Emphasis
292+
293+
Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
294+
emphasis. Text wrapped with one `*` or `_` will be wrapped with an
295+
HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
296+
`<strong>` tag. E.g., this input:
297+
298+
_single asterisks_
299+
300+
_single underscores_
301+
302+
**double asterisks**
303+
304+
**double underscores**
305+
306+
### Code
307+
308+
To indicate a span of code, wrap it with backtick quotes (`` ` ``).
309+
Unlike a pre-formatted code block, a code span indicates code within a
310+
normal paragraph. For example:
311+
312+
Use the `printf()` function.
313+
314+
![bagel image](https://plus.unsplash.com/premium_photo-1769376812336-847642b315a2?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)

uno.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
defineConfig,
33
presetIcons,
4+
presetTypography,
45
presetWind4,
56
transformerDirectives,
67
transformerVariantGroup,
@@ -23,6 +24,7 @@ export default defineConfig({
2324
custom: customIcons,
2425
},
2526
}),
27+
presetTypography(),
2628
],
2729
transformers: [transformerDirectives(), transformerVariantGroup()],
2830
theme: {

0 commit comments

Comments
 (0)