@humanonlyweb/writer 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ # Content
2
+
3
+ > Markdown, rendered with your components.
4
+
5
+ `<WriterContent>` renders Markdown, or a document parsed ahead of time. In plain Vue, import `WriterContent`.
6
+
7
+ ## Examples
8
+
9
+ ### Live preview
10
+
11
+ Markdown renders as you type; `debounce` waits a beat before parsing again.
12
+
13
+ ```vue
14
+ <script setup lang="ts">
15
+ const body = ref(`## Rendered
16
+
17
+ Type on the left: **Markdown** renders on the right, blocks included.
18
+
19
+ ::callout
20
+ A callout block.
21
+ ::`);
22
+ </script>
23
+
24
+ <template>
25
+ <div class="writer-demo writer-demo-split">
26
+ <UiTextarea v-model="body" label="Markdown" />
27
+ <WriterContent :value="body" :debounce="100" />
28
+ </div>
29
+ </template>
30
+ ```
31
+
32
+ ## Props
33
+
34
+ | Prop | Type | Description |
35
+ | ------------ | ---------------------------- | -------------------------------------------------------------------- |
36
+ | `value` | `string \| MarkdownDocument` | Markdown, or a document parsed ahead of time (no parser download). |
37
+ | `components` | `Record<string, Component>` | Native element overrides for this render, e.g. `{ a: NuxtLink }`. |
38
+ | `debounce` | `number` | Ms to wait before parsing changed Markdown again. ~100 for previews. |
39
+ | `tag` | `string` | Wrapper element. Default `div`. |
40
+
41
+ Give it a parsed document on public pages: they render without loading the parser. A string works anywhere, server rendering included, and loads the parser on demand.
42
+
43
+ ## What renders
44
+
45
+ - Markdown's own elements, and registered [blocks](/blocks). Anything else renders its content only.
46
+ - Images load lazily. An image alone in its paragraph, with a title, becomes a `<figure>`. See [Images](/images).
47
+ - Content is sanitized again before rendering. See [Security](/security).
48
+
49
+ ## Your own wrapper
50
+
51
+ `renderDocument(document, { blocks, components })` returns the rendered Vue nodes, for when `<WriterContent>` doesn't fit. These docs render their pages with it.
@@ -0,0 +1,236 @@
1
+ # Editor
2
+
3
+ > Markdown in, a live preview while you write.
4
+
5
+ `<WriterEditor>` edits Markdown, held in its `v-model`. In plain Vue, import `WriterEditor`.
6
+
7
+ ## Examples
8
+
9
+ ### Basic
10
+
11
+ ```vue
12
+ <script setup lang="ts">
13
+ const body = ref(`## A heading
14
+
15
+ Some **bold**, some _italic_, a [link](https://example.com) and \`code\`.
16
+
17
+ - A list
18
+ - [x] A done task
19
+
20
+ > A quote.`);
21
+ const editor = useTemplateRef("editor");
22
+ </script>
23
+
24
+ <template>
25
+ <div class="writer-demo">
26
+ <WriterToolbar
27
+ :editor="editor"
28
+ :items="['heading2', 'bold', 'italic', 'link', 'quote', 'bulletList', 'image']"
29
+ />
30
+ <WriterEditor ref="editor" v-model="body" label="Body" placeholder="Start writing…" />
31
+ </div>
32
+ </template>
33
+ ```
34
+
35
+ ### Source mode
36
+
37
+ Plain Markdown throughout, with the source highlighted.
38
+
39
+ ```vue
40
+ <script setup lang="ts">
41
+ const body = ref(`## Plain Markdown
42
+
43
+ Every **mark** stays where you can see it.
44
+
45
+ ::callout
46
+ Blocks too.
47
+ ::`);
48
+ </script>
49
+
50
+ <template>
51
+ <div class="writer-demo">
52
+ <WriterEditor v-model="body" mode="source" label="Body" />
53
+ </div>
54
+ </template>
55
+ ```
56
+
57
+ ### Uploads
58
+
59
+ Pass `upload` and files can be pasted, dropped or picked. It gets the `File` and resolves to its URL.
60
+
61
+ ```vue
62
+ <script setup lang="ts">
63
+ const body = ref("Drop, paste or choose an image:\n\n![]()\n");
64
+ const editor = useTemplateRef("editor");
65
+ const error = ref("");
66
+
67
+ // Your endpoint stores the file and answers with its URL. Here: the image inlined,
68
+ // after a moment, so you can see it upload.
69
+ async function upload(file: File) {
70
+ await new Promise((resolve) => setTimeout(resolve, 1500));
71
+ return new Promise<string>((resolve) => {
72
+ const reader = new FileReader();
73
+ reader.addEventListener("load", () => resolve(String(reader.result)));
74
+ reader.readAsDataURL(file);
75
+ });
76
+ }
77
+ </script>
78
+
79
+ <template>
80
+ <div class="writer-demo">
81
+ <WriterToolbar :editor="editor" :items="['bold', 'italic', 'image']" />
82
+ <WriterEditor
83
+ ref="editor"
84
+ v-model="body"
85
+ label="Body"
86
+ :upload="upload"
87
+ @upload-error="(_, file) => (error = `Couldn't upload ${file.name}.`)"
88
+ />
89
+ <p class="writer-demo-stats">
90
+ {{ error || (editor?.uploading ? "Uploading…" : "Ready to save") }}
91
+ </p>
92
+ </div>
93
+ </template>
94
+ ```
95
+
96
+ ### Read-only
97
+
98
+ `readonly` locks everything: the text, task checkboxes and image cards.
99
+
100
+ ```vue
101
+ <script setup lang="ts">
102
+ const body = ref(`## Read-only
103
+
104
+ Nothing here can change: not the text, not the task,
105
+ and not the image card below.
106
+
107
+ - [x] A done task
108
+
109
+ ![A snowy street](https://picsum.photos/id/1036/900/360 "Look, don't touch."){width="900" height="360"}`);
110
+ const readonly = ref(true);
111
+ </script>
112
+
113
+ <template>
114
+ <div class="writer-demo">
115
+ <div class="writer-demo-bar">
116
+ <span class="writer-demo-stats">{{ readonly ? "Read-only" : "Editable" }}</span>
117
+ <button
118
+ type="button"
119
+ class="writer-demo-toggle"
120
+ :aria-pressed="readonly"
121
+ @click="readonly = !readonly"
122
+ >
123
+ Read-only
124
+ </button>
125
+ </div>
126
+ <WriterEditor v-model="body" :readonly="readonly" label="Body" />
127
+ </div>
128
+ </template>
129
+ ```
130
+
131
+ ### Link suggestions
132
+
133
+ `links` suggests targets as the author types `](`, e.g. your site's pages.
134
+
135
+ ```vue
136
+ <script setup lang="ts">
137
+ const body = ref("Type `](` after some text in brackets: [the council](");
138
+
139
+ const pages = [
140
+ { label: "City council", url: "/topics/council" },
141
+ { label: "Winter", url: "/topics/winter" },
142
+ { label: "Dale", url: "/people/dale" },
143
+ ];
144
+ const links = (query: string) => pages.filter((page) => page.url.includes(query));
145
+ </script>
146
+
147
+ <template>
148
+ <div class="writer-demo">
149
+ <WriterEditor v-model="body" label="Body" :links="links" />
150
+ </div>
151
+ </template>
152
+ ```
153
+
154
+ ## Live preview
155
+
156
+ The document is always Markdown, but it reads like the page:
157
+
158
+ - **Formatting:** marks hide except in the element being edited. `**bold**` shows its asterisks only while the cursor is in it. Heading, quote and list marks show on the cursor's line.
159
+ - **Blocks** render with your components. Click or arrow into one and its source opens, framed, in the same spot. Set `--writer-block-inset` and `--writer-block-background` to your blocks' padding and background, and the text doesn't jump.
160
+ - **Images** on their own line are cards: the published figure, with caption and alt text typed in place. Drop, paste or pick a file to fill or replace one.
161
+ - **Leaving the editor** shows everything as published. The cursor stays put for when you come back.
162
+
163
+ `mode="source"` turns it off.
164
+
165
+ ## Props
166
+
167
+ | Prop | Type | Description |
168
+ | --------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
169
+ | `v-model` | `string` | The Markdown. |
170
+ | `label` | `string` | Accessible name. Default: "Markdown editor". |
171
+ | `labelledby` | `string` | Id of the element naming it, instead of `label`. |
172
+ | `describedby` | `string` | Id of a hint or error. |
173
+ | `name` | `string` | Submits the Markdown with its form. |
174
+ | `placeholder` | `string` | |
175
+ | `readonly` | `boolean` | |
176
+ | `mode` | `"live" \| "source"` | Live preview (default) or plain Markdown. |
177
+ | `upload` | `(file: File) => Promise<string>` | Enables pasting, dropping and picking files. Resolve to the URL. |
178
+ | `links` | `(query) => { label, url }[]` (or a promise) | Suggests link targets after `](`. |
179
+ | `codeLanguages` | `LanguageDescription[]` | Highlighting inside fenced code, e.g. `languages` from `@codemirror/language-data`. |
180
+ | `extensions` | `Extension` | Extra CodeMirror extensions. Read once, on mount. |
181
+
182
+ ## Events
183
+
184
+ | Event | Payload | When |
185
+ | -------------- | ------------------------------ | ------------------------------------------------------------------------------- |
186
+ | `focus` | | The editor gets focus. |
187
+ | `blur` | | It loses it. |
188
+ | `upload-error` | `(error: unknown, file: File)` | An `upload` rejected. Its placeholder is gone, or the card's old image is back. |
189
+
190
+ ## Exposed
191
+
192
+ Through a template ref:
193
+
194
+ | Member | Description |
195
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------- |
196
+ | `ready` | CodeMirror has loaded. |
197
+ | `active` | Formatting at the cursor, a `Set` of command names. |
198
+ | `canUpload` | `upload` is set. |
199
+ | `canUndo`, `canRedo` | |
200
+ | `uploading` | Uploads in progress. Save when it's `0`. |
201
+ | `run(command)` | Applies a [command](/components/toolbar#commands). `image` opens the file picker with `upload`, else inserts an empty card. |
202
+ | `insert(text)` | Replaces the selection. |
203
+ | `insertFiles(files)` | Uploads and inserts files at the cursor. |
204
+ | `focus()` | |
205
+ | `view()` | The CodeMirror `EditorView`, for anything else. |
206
+
207
+ ## Keyboard
208
+
209
+ `Mod` is Ctrl, or ⌘ on a Mac.
210
+
211
+ | Keys | Description |
212
+ | ------------------------------- | ------------------------------------------------------------ |
213
+ | `Mod+B` `Mod+I` `Mod+E` `Mod+K` | Bold, italic, code, link |
214
+ | `Mod+Shift+X` | Strikethrough |
215
+ | `Mod+Alt+1` … `3` | Heading 1–3 |
216
+ | `Mod+Shift+7` `8` `9` | Numbered, bulleted, task list |
217
+ | `Mod+Alt+F` | Footnote |
218
+ | `Mod+Z` `Mod+Shift+Z` | Undo, redo |
219
+ | `Enter` | New paragraph (in a quote, inside it); in a list, a new item |
220
+ | `Shift+Enter` | Line break inside the paragraph (`\` at the line end) |
221
+ | `/` on an empty line | Block menu |
222
+ | `Mod+]` `Mod+[` | Indent, outdent |
223
+
224
+ `Tab` leaves the editor, so keyboard users aren't trapped. Pasting a URL over a selection links it.
225
+
226
+ ## Uploads
227
+
228
+ While a file uploads, the Markdown holds an `#upload-…` placeholder where its URL will go, and `uploading` counts what's in flight. Wait for `0` before saving: the URL landing changes the Markdown, so a save-on-change runs again by itself. A placeholder saved anyway renders nothing, and in the editor it's an empty card to fill again.
229
+
230
+ ## Loading another document
231
+
232
+ Change the editor's `key`. An outside `v-model` change is applied as an edit, keeping undo history; a new document should start fresh.
233
+
234
+ ## Server rendering
235
+
236
+ The server renders the content as it will read (a `<textarea>` in source mode). CodeMirror loads in the browser and takes over, keeping anything typed before it did. Pages without an editor never load CodeMirror.
@@ -0,0 +1,146 @@
1
+ # Toolbar
2
+
3
+ > Formatting buttons for an editor.
4
+
5
+ `<WriterToolbar>` formats an editor: pass it the editor's template ref. In plain Vue, import `WriterToolbar`.
6
+
7
+ ## Examples
8
+
9
+ ### Basic
10
+
11
+ ```vue
12
+ <script setup lang="ts">
13
+ const body = ref("Select some text, then format it.");
14
+ const editor = useTemplateRef("editor");
15
+ </script>
16
+
17
+ <template>
18
+ <div class="writer-demo">
19
+ <WriterToolbar
20
+ :editor="editor"
21
+ :items="[
22
+ 'heading2',
23
+ 'bold',
24
+ 'italic',
25
+ 'strikethrough',
26
+ 'link',
27
+ 'bulletList',
28
+ 'taskList',
29
+ 'undo',
30
+ 'redo',
31
+ ]"
32
+ />
33
+ <WriterEditor ref="editor" v-model="body" label="Body" />
34
+ </div>
35
+ </template>
36
+ ```
37
+
38
+ ### Every command
39
+
40
+ Try each one on an empty line, in the middle of a line and on a selection. Blocks (tables, dividers, images, code) get blank lines around them, so they never join the text next to them.
41
+
42
+ ```vue
43
+ <script setup lang="ts">
44
+ import type { CommandName } from "@humanonlyweb/writer";
45
+
46
+ // Every command. Try each one on an empty line, in the middle of a line, and on a
47
+ // selection: the cursor should always land where the next word goes.
48
+ const items: CommandName[] = [
49
+ "heading1",
50
+ "heading2",
51
+ "heading3",
52
+ "bold",
53
+ "italic",
54
+ "strikethrough",
55
+ "code",
56
+ "link",
57
+ "quote",
58
+ "bulletList",
59
+ "orderedList",
60
+ "taskList",
61
+ "codeBlock",
62
+ "table",
63
+ "divider",
64
+ "image",
65
+ "footnote",
66
+ "undo",
67
+ "redo",
68
+ ];
69
+
70
+ const body = ref("A line to format.\n\n");
71
+ const editor = useTemplateRef("editor");
72
+ const mode = ref<"live" | "source">("live");
73
+ </script>
74
+
75
+ <template>
76
+ <div class="writer-demo">
77
+ <div class="writer-demo-bar">
78
+ <WriterToolbar :editor="editor" :items="items" />
79
+ <button
80
+ type="button"
81
+ class="writer-demo-toggle"
82
+ :aria-pressed="mode === 'source'"
83
+ @click="mode = mode === 'source' ? 'live' : 'source'"
84
+ >
85
+ Markdown
86
+ </button>
87
+ </div>
88
+ <WriterEditor ref="editor" v-model="body" :mode="mode" label="Body" />
89
+ </div>
90
+ </template>
91
+ ```
92
+
93
+ ### Icons
94
+
95
+ The `item` slot replaces a button's content. Its label stays the accessible name.
96
+
97
+ ```vue
98
+ <script setup lang="ts">
99
+ const body = ref("Icons instead of words; the names stay for screen readers.");
100
+ const editor = useTemplateRef("editor");
101
+ const icons = {
102
+ bold: "bold",
103
+ italic: "italic",
104
+ link: "link",
105
+ quote: "quote",
106
+ image: "image",
107
+ } as const;
108
+ </script>
109
+
110
+ <template>
111
+ <div class="writer-demo">
112
+ <WriterToolbar :editor="editor" :items="Object.keys(icons) as (keyof typeof icons)[]">
113
+ <template #item="{ command }">
114
+ <Icon :name="icons[command as keyof typeof icons]" />
115
+ </template>
116
+ </WriterToolbar>
117
+ <WriterEditor ref="editor" v-model="body" label="Body" />
118
+ </div>
119
+ </template>
120
+ ```
121
+
122
+ ## Props
123
+
124
+ | Prop | Type | Description |
125
+ | -------- | --------------- | ----------------------------------------------------------------------------------------------------- |
126
+ | `editor` | editor ref | The `<WriterEditor>` to format: pass its template ref. |
127
+ | `items` | `CommandName[]` | Commands, in order. Default: headings 2–3, bold, italic, link, code, quote, lists, code block, image. |
128
+ | `label` | `string` | Accessible name. Default: "Formatting". |
129
+
130
+ ## Slots
131
+
132
+ | Slot | Props | Description |
133
+ | ------ | ---------------------------- | --------------------------------- |
134
+ | `item` | `{ command, label, active }` | A button's content, e.g. an icon. |
135
+
136
+ ## Commands
137
+
138
+ `bold`, `italic`, `strikethrough`, `code`, `link`, `heading1`, `heading2`, `heading3`, `quote`, `bulletList`, `orderedList`, `taskList`, `codeBlock`, `table`, `divider`, `image`, `footnote`, `undo`, `redo`.
139
+
140
+ Headings, quotes and lists replace each other on a line, and the cursor ends after their marks. Italic writes `*`, which works inside a word; spaces at a selection's edges stay outside the marks. `image` opens the file picker when the editor has `upload`, and otherwise inserts an empty image card.
141
+
142
+ For a different toolbar entirely, call the editor's `run(command)` yourself. `ToolbarEditor` is the type of what the toolbar needs from an editor.
143
+
144
+ ## Accessibility
145
+
146
+ `role="toolbar"`, with one tab stop: arrow keys, Home and End move between buttons. Formatting buttons show `aria-pressed`; `undo` and `redo` are `aria-disabled` when there's nothing to undo or redo. Buttons don't take focus from the editor.
@@ -0,0 +1,93 @@
1
+ # Images
2
+
3
+ > Images, figures and uploads.
4
+
5
+ ## In Markdown
6
+
7
+ Plain Markdown, no block needed: `![Alt text](/cat.png)`. Alone in its paragraph with a title, it becomes a figure:
8
+
9
+ ```md
10
+ ![A cat on a sofa](/cat.png "Our cat, 2026")
11
+ ```
12
+
13
+ ```html
14
+ <figure>
15
+ <img src="/cat.png" alt="A cat on a sofa" loading="lazy" decoding="async" />
16
+ <figcaption>Our cat, 2026</figcaption>
17
+ </figure>
18
+ ```
19
+
20
+ Size it with attributes so the page doesn't shift: `![Alt](/cat.png){width="800" height="600"}`. Uploads add them for you.
21
+
22
+ - `data:image/…` URLs work, for images only.
23
+ - An image without a URL (`![]()`) doesn't render. In the editor it's an empty card to fill.
24
+ - For responsive images or a CDN, replace `img` through `components`, e.g. `{ img: "NuxtImg" }`.
25
+
26
+ ## In the editor
27
+
28
+ Images on their own line are cards: the picture, its caption and its alt text, edited in place. Arrowing onto a card selects it; Backspace or Delete removes it, Enter adds a paragraph after it. A card never turns back into Markdown; switch to source mode for that.
29
+
30
+ ### Icons for Replace and Remove
31
+
32
+ A card's buttons say Replace and Remove. To show icons instead, fill the editor's `image-replace` and `image-remove` slots. The words stay the buttons' accessible names, and the buttons get `data-icon` for styling. Cards are built outside Vue, so each card gets a copy of what the slot rendered: keep it static, like an icon.
33
+
34
+ ```vue
35
+ <template>
36
+ <WriterEditor v-model="body" :upload="upload">
37
+ <template #image-replace><MyIcon name="photo" /></template>
38
+ <template #image-remove><MyIcon name="trash" /></template>
39
+ </WriterEditor>
40
+ </template>
41
+ ```
42
+
43
+ ## Uploads
44
+
45
+ Give the editor an `upload` function: it gets the `File` and resolves to its URL.
46
+
47
+ ```ts
48
+ async function upload(file: File) {
49
+ const body = new FormData();
50
+ body.append("file", file);
51
+ const { url } = await $fetch<{ url: string }>("/api/uploads", { method: "POST", body });
52
+ return url;
53
+ }
54
+ ```
55
+
56
+ While it uploads, the card shows the local file at its real size, so nothing moves when the URL arrives. Several files upload side by side, in order. A failed upload fires `upload-error` and removes its placeholder, or puts a replaced card back the way it was.
57
+
58
+ On the server, check what you're given: the file type by its first bytes, not its name, and a size limit. Don't accept SVG on your own origin: it can run script.
59
+
60
+ ```vue
61
+ <script setup lang="ts">
62
+ const body = ref("Drop, paste or choose an image:\n\n![]()\n");
63
+ const editor = useTemplateRef("editor");
64
+ const error = ref("");
65
+
66
+ // Your endpoint stores the file and answers with its URL. Here: the image inlined,
67
+ // after a moment, so you can see it upload.
68
+ async function upload(file: File) {
69
+ await new Promise((resolve) => setTimeout(resolve, 1500));
70
+ return new Promise<string>((resolve) => {
71
+ const reader = new FileReader();
72
+ reader.addEventListener("load", () => resolve(String(reader.result)));
73
+ reader.readAsDataURL(file);
74
+ });
75
+ }
76
+ </script>
77
+
78
+ <template>
79
+ <div class="writer-demo">
80
+ <WriterToolbar :editor="editor" :items="['bold', 'italic', 'image']" />
81
+ <WriterEditor
82
+ ref="editor"
83
+ v-model="body"
84
+ label="Body"
85
+ :upload="upload"
86
+ @upload-error="(_, file) => (error = `Couldn't upload ${file.name}.`)"
87
+ />
88
+ <p class="writer-demo-stats">
89
+ {{ error || (editor?.uploading ? "Uploading…" : "Ready to save") }}
90
+ </p>
91
+ </div>
92
+ </template>
93
+ ```
@@ -0,0 +1,86 @@
1
+ # Introduction
2
+
3
+ > A Markdown editor and renderer for Vue 3 and Nuxt.
4
+
5
+ Authors write Markdown, but it reads like the published page: formatting marks tuck away, blocks render as your own components, and images are cards with their caption and alt text. Readers get the same Markdown rendered by the same components, server-side.
6
+
7
+ ```vue
8
+ <script setup lang="ts">
9
+ import { countWords, readingMinutes } from "@humanonlyweb/writer";
10
+
11
+ const body =
12
+ ref(`City council voted 7–2 on Tuesday to approve this winter's snow-clearing budget, which officials describe as "ambitious, in a spiritual sense."
13
+
14
+ ::callout{type="note"}
15
+ The **full budget** is available at city hall, between 2:00 and 2:05 p.m.
16
+ ::
17
+
18
+ ## What residents can do
19
+
20
+ - Shovel early, shovel often
21
+ - [x] Buy salt
22
+ - [ ] Lower expectations
23
+
24
+ > "It's not a plan, it's a vibe," said one resident.
25
+
26
+ ![A snowy street](https://picsum.photos/id/1036/900/360 "Cul-de-sac, February. Artist's impression."){width="900" height="360"}
27
+
28
+ Drop a photo of your street below, or choose one:
29
+
30
+ ![]()
31
+ `);
32
+
33
+ const editor = useTemplateRef("editor");
34
+ const mode = ref<"live" | "source">("live");
35
+ const icons = {
36
+ heading2: "heading",
37
+ bold: "bold",
38
+ italic: "italic",
39
+ link: "link",
40
+ quote: "quote",
41
+ bulletList: "list",
42
+ image: "image",
43
+ } as const;
44
+ const words = computed(() => countWords(body.value));
45
+
46
+ // A stand-in for your upload endpoint: the image, inlined, after a moment.
47
+ async function upload(file: File) {
48
+ await new Promise((resolve) => setTimeout(resolve, 1500));
49
+ return new Promise<string>((resolve) => {
50
+ const reader = new FileReader();
51
+ reader.addEventListener("load", () => resolve(String(reader.result)));
52
+ reader.readAsDataURL(file);
53
+ });
54
+ }
55
+ </script>
56
+
57
+ <template>
58
+ <div class="writer-demo">
59
+ <div class="writer-demo-bar">
60
+ <WriterToolbar :editor="editor" :items="Object.keys(icons) as (keyof typeof icons)[]">
61
+ <template #item="{ command }">
62
+ <Icon :name="icons[command as keyof typeof icons]" />
63
+ </template>
64
+ </WriterToolbar>
65
+ <button
66
+ type="button"
67
+ class="writer-demo-toggle"
68
+ :aria-pressed="mode === 'source'"
69
+ @click="mode = mode === 'source' ? 'live' : 'source'"
70
+ >
71
+ Markdown
72
+ </button>
73
+ </div>
74
+ <WriterEditor ref="editor" v-model="body" :mode="mode" label="Article" :upload="upload" />
75
+ <p class="writer-demo-stats">{{ words }} words · {{ readingMinutes(words) }} min read</p>
76
+ </div>
77
+ </template>
78
+ ```
79
+
80
+ - **Markdown is the source of truth.** Store it, diff it, edit it anywhere.
81
+ - **Blocks are your Vue components.** `::callout` renders `Callout.vue`, in the editor and on the page.
82
+ - **Fast pages.** Parse on save and render the stored document: visitors download neither the parser nor the editor.
83
+ - **Safe by default.** Raw HTML is text, and only Markdown's own elements and your blocks render.
84
+ - **SSR, accessible, unstyled.** Works with server rendering, follows the ARIA patterns, and takes your site's CSS.
85
+
86
+ Built on [CodeMirror 6](https://codemirror.net) and [Comark](https://comark.dev).