Skip to content

Commit 8b10893

Browse files
authored
docs: various improvements (#210)
1 parent 8ec994d commit 8b10893

10 files changed

Lines changed: 106 additions & 81 deletions

File tree

docs/app/components/landing/HeroDemo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ onBeforeUnmount(() => {
113113
variant="subtle"
114114
color="neutral"
115115
size="xs"
116-
to="/play"
116+
to="/play/editor?example=all-features"
117117
/>
118118
</div>
119119

docs/app/components/landing/LandingFeatureFrameworks.vue

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defineProps<{
1313
svelteLinkTo: string
1414
}>()
1515
16-
const activeTab = ref<'vue' | 'react' | 'svelte'>('vue')
16+
const activeTab = ref<'react' | 'svelte' | 'vue'>('react')
1717
1818
const vueCode = `<script setup lang="ts">
1919
import { Comark } from '@comark/vue'
@@ -72,9 +72,9 @@ ${'<'}/script>
7272
const { data: highlighted } = await useAsyncData('fw-highlight', async () => {
7373
const themes = { light: 'github-light', dark: 'github-dark' } as const
7474
const [vue, react, svelte] = await Promise.all([
75-
codeToHtml(vueCode, { lang: 'vue', themes }),
7675
codeToHtml(reactCode, { lang: 'tsx', themes }),
7776
codeToHtml(svelteCode, { lang: 'svelte', themes }),
77+
codeToHtml(vueCode, { lang: 'vue', themes }),
7878
])
7979
return { vue, react, svelte }
8080
})
@@ -97,19 +97,6 @@ const { data: highlighted } = await useAsyncData('fw-highlight', async () => {
9797

9898
<div class="mt-6 overflow-hidden border border-muted bg-muted/50">
9999
<div class="flex items-center border-b border-muted">
100-
<button
101-
class="flex items-center gap-2 border-b-2 px-4 py-2 font-mono text-xs"
102-
:class="
103-
activeTab === 'vue' ? 'border-primary text-primary' : 'border-transparent text-muted hover:text-highlighted'
104-
"
105-
@click="activeTab = 'vue'"
106-
>
107-
<UIcon
108-
name="i-logos-vue"
109-
class="size-3.5"
110-
/>
111-
App.vue
112-
</button>
113100
<button
114101
class="flex items-center gap-2 border-b-2 px-4 py-2 font-mono text-xs"
115102
:class="
@@ -140,13 +127,21 @@ const { data: highlighted } = await useAsyncData('fw-highlight', async () => {
140127
/>
141128
App.svelte
142129
</button>
130+
<button
131+
class="flex items-center gap-2 border-b-2 px-4 py-2 font-mono text-xs"
132+
:class="
133+
activeTab === 'vue' ? 'border-primary text-primary' : 'border-transparent text-muted hover:text-highlighted'
134+
"
135+
@click="activeTab = 'vue'"
136+
>
137+
<UIcon
138+
name="i-logos-vue"
139+
class="size-3.5"
140+
/>
141+
App.vue
142+
</button>
143143
</div>
144144
<div class="shiki-block h-[280px] overflow-auto p-4">
145-
<div
146-
v-show="activeTab === 'vue'"
147-
class="text-sm/6"
148-
v-html="highlighted?.vue"
149-
/>
150145
<div
151146
v-show="activeTab === 'react'"
152147
class="text-sm/6"
@@ -157,28 +152,39 @@ const { data: highlighted } = await useAsyncData('fw-highlight', async () => {
157152
class="text-sm/6"
158153
v-html="highlighted?.svelte"
159154
/>
155+
<div
156+
v-show="activeTab === 'vue'"
157+
class="text-sm/6"
158+
v-html="highlighted?.vue"
159+
/>
160160
</div>
161161
</div>
162162

163163
<div class="mt-4 flex items-center gap-4">
164164
<UButton
165-
:label="vueLinkLabel"
166-
:to="vueLinkTo"
165+
:label="reactLinkLabel"
166+
:to="reactLinkTo"
167167
variant="link"
168+
color="neutral"
169+
leading-icon="i-simple-icons-react"
168170
trailing-icon="i-lucide-arrow-right"
169171
class="px-0"
170172
/>
171173
<UButton
172-
:label="reactLinkLabel"
173-
:to="reactLinkTo"
174+
:label="svelteLinkLabel"
175+
:to="svelteLinkTo"
174176
variant="link"
177+
color="neutral"
178+
leading-icon="i-simple-icons-svelte"
175179
trailing-icon="i-lucide-arrow-right"
176180
class="px-0"
177181
/>
178182
<UButton
179-
:label="svelteLinkLabel"
180-
:to="svelteLinkTo"
183+
:label="vueLinkLabel"
184+
:to="vueLinkTo"
181185
variant="link"
186+
color="neutral"
187+
leading-icon="i-simple-icons-vuedotjs"
182188
trailing-icon="i-lucide-arrow-right"
183189
class="px-0"
184190
/>

docs/app/constants/index.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,9 @@ page:
120120
maxWidth: 1120px
121121
---
122122
123-
# Hello Comark
123+
# Comark Playground
124124
125-
This is a **Comark** playground inside DevTools.
126-
127-
Write Markdown with component syntax and see the parsed AST in real-time.
125+
Write Markdown with component syntax and see the preview and parsed AST in real-time.
128126
129127
## Features
130128
@@ -140,14 +138,23 @@ Write Markdown with component syntax and see the parsed AST in real-time.
140138
141139
### Component Syntax
142140
143-
::callout{color="info" icon="i-lucide-info"}
144-
This is a Comark component using MDC syntax.
141+
::callout{color="success" icon="i-lucide-lightbulb"}
142+
This is a Vue component using the Markdown components syntax.
145143
::
146144
145+
::card{icon="i-lucide-rocket" color="primary"}
146+
#title
147+
Another component
148+
#default
149+
With 2 slots, title and default.
150+
::
151+
152+
You can use all the [Nuxt UI Typography components](https://ui.nuxt.com/docs/typography/accordion){target="_blank"} in this playground.
153+
147154
### Github Alert
148155
149-
> [!WARNING]
150-
> This is a warning alert.
156+
> [!NOTE]
157+
> This is a note callout.
151158
152159
### Math
153160

docs/content/1.getting-started/0.introduction.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,20 @@ Comark is ideal for:
192192
## How It Works
193193

194194
::div{.border .border-default .rounded .bg-muted .p-4}
195-
```mermaid {height="250px"}
195+
```mermaid
196196
graph LR
197-
A[Markdown + Comark] --> B[Parser]
197+
A[Markdown] --> B[Parser]
198198
B --> C[Comark AST]
199199
C --> D{Renderer}
200-
D --> E[Vue]
200+
D --> I[ANSI]
201+
D --> H[HTML]
202+
D --> J[Markdown]
201203
D --> F[React]
202-
D --> G[HTML]
204+
D --> G[Svelte]
205+
D --> E[Vue]
203206
```
204207
::
205208

206-
1. **Parse** - Comark parses your content into a compact [Comark AST](/syntax/comark-ast)
209+
1. **Parse** - Comark parses Markdown into a compact [Comark AST](/syntax/comark-ast)
207210
2. **Transform** - The AST can be manipulated, cached, or serialized
208-
3. **Render** - Framework-specific renderers convert the AST to Vue or React components
211+
3. **Render** - Framework-specific renderers convert the AST to React, Svelte or Vue components, or render to string in Markdown, HTML or ANSI.

docs/content/4.plugins/index.md

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,66 @@ Comark's plugin system extends markdown functionality with specialized features.
99
## Plugins
1010

1111
::card-group{cols="2"}
12-
::card{icon="i-lucide-shield-check" title="Security" to="/plugins/built-in/security"}
13-
Sanitize markdown by removing dangerous HTML elements and attributes
12+
::card{icon="i-lucide-bell" title="Alerts" to="/plugins/built-in/alert"}
13+
Render GitHub-style alert blockquotes with icons and colors
14+
::
15+
16+
::card{icon="i-lucide-replace" title="Binding" to="/plugins/built-in/binding"}
17+
Interpolate frontmatter, runtime data, or parent props with `{{ path || default }}` shorthand
18+
::
19+
20+
::card{icon="i-lucide-corner-down-left" title="Breaks" to="/plugins/built-in/breaks"}
21+
Convert soft line breaks directly into `:br` components
1422
::
1523

1624
::card{icon="i-lucide-smile" title="Emoji" to="/plugins/built-in/emoji"}
1725
Convert emoji shortcodes like `:smile:` into emoji characters
1826
::
1927

20-
::card{icon="i-lucide-code" title="Syntax Highlighting" to="/plugins/built-in/syntax-highlight"}
21-
Beautiful code syntax highlighting using Shiki with multi-theme support
28+
::card{icon="i-lucide-footprints" title="Footnotes" to="/plugins/built-in/emoji"}
29+
Plugin for adding footnote references and definitions to your Comark documents.
2230
::
2331

24-
::card{icon="i-lucide-file-text" title="Summary" to="/plugins/built-in/summary"}
25-
Extract content summaries using `<!-- more -->` delimiter
32+
::card{icon="i-lucide-heading" title="Headings" to="/plugins/built-in/emoji"}
33+
Plugin for extracting the page title and description from document content.
2634
::
2735

28-
::card{icon="i-lucide-list" title="Table of Contents" to="/plugins/built-in/toc"}
29-
Generate hierarchical TOC from headings automatically
36+
::card{icon="i-lucide-braces" title="JSON Render" to="/plugins/built-in/json-render"}
37+
Transform JSON Render specs into UI components using `json-render` or `yaml-render` code blocks
3038
::
3139

32-
::card{icon="i-lucide-bell" title="Alerts" to="/plugins/built-in/alert"}
33-
Render GitHub-style alert blockquotes with icons and colors
40+
::card{icon="i-lucide-calculator" title="Mathematics" to="/plugins/built-in/math"}
41+
Render LaTeX math formulas using KaTeX with inline and display equations
3442
::
3543

36-
::card{icon="i-lucide-check-square" title="Task List" to="/plugins/built-in/task-list"}
37-
Render interactive checkboxes from `[ ]` and `[x]` list syntax
44+
::card{icon="i-simple-icons-mermaid" title="Mermaid Diagrams" to="/plugins/built-in/mermaid"}
45+
Create diagrams and visualizations using Mermaid syntax in code blocks
3846
::
3947

40-
::card{icon="i-simple-icons-mermaid" title="Mermaid" to="/plugins/built-in/mermaid"}
41-
Create diagrams and visualizations using Mermaid syntax in code blocks
48+
::card{icon="i-lucide-quote" title="Punctuation" to="/plugins/built-in/punctuation"}
49+
Convert plain-text punctuation into typographically correct Unicode characters
4250
::
4351

44-
::card{icon="i-lucide-calculator" title="Math" to="/plugins/built-in/math"}
45-
Render LaTeX math formulas using KaTeX with inline and display equations
52+
::card{icon="i-lucide-shield-check" title="Security" to="/plugins/built-in/security"}
53+
Sanitize markdown by removing dangerous HTML elements and attributes
4654
::
4755

48-
::card{icon="i-lucide-braces" title="JSON Render" to="/plugins/built-in/json-render"}
49-
Transform JSON Render specs into UI components using `json-render` or `yaml-render` code blocks
56+
::card{icon="i-lucide-file-text" title="Summary Extraction" to="/plugins/built-in/summary"}
57+
Extract content summaries using `<!-- more -->` delimiter
5058
::
5159

52-
::card{icon="i-lucide-quote" title="Punctuation" to="/plugins/built-in/punctuation"}
53-
Convert plain-text punctuation into typographically correct Unicode characters
60+
::card{icon="i-lucide-code" title="Syntax Highlighting" to="/plugins/built-in/syntax-highlight"}
61+
Beautiful code syntax highlighting using Shiki with multi-theme support
5462
::
5563

56-
::card{icon="i-lucide-corner-down-left" title="Breaks" to="/plugins/built-in/breaks"}
57-
Convert soft line breaks directly into `:br` components
64+
::card{icon="i-lucide-check-square" title="Task List" to="/plugins/built-in/task-list"}
65+
Render interactive checkboxes from `[ ]` and `[x]` list syntax
5866
::
59-
60-
::card{icon="i-lucide-replace" title="Binding" to="/plugins/built-in/binding"}
61-
Interpolate frontmatter, runtime data, or parent props with `{{ path || default }}` shorthand
67+
68+
::card{icon="i-lucide-list" title="Table of Contents" to="/plugins/built-in/toc"}
69+
Generate hierarchical TOC from headings automatically
6270
::
71+
6372
::
6473

6574
## Guides
@@ -69,13 +78,13 @@ Comark's plugin system extends markdown functionality with specialized features.
6978
Define plugins with the ComarkPlugin interface and lifecycle hooks
7079
::
7180

72-
::card{icon="i-simple-icons-markdown" title="Markdown-it Plugins" to="/plugins/custom/markdown-it"}
73-
Use existing markdown-it plugins or create new parser syntax rules
74-
::
75-
7681
::card{icon="i-lucide-git-branch" title="AST API" to="/plugins/custom/ast-api"}
7782
Traverse and transform the ComarkTree AST using the visit() utility
7883
::
84+
85+
::card{icon="i-simple-icons-markdown" title="Markdown-it Plugins" to="/plugins/custom/markdown-it"}
86+
Use existing markdown-it plugins or create new parser syntax rules
87+
::
7988
::
8089

8190
## Use Plugins

docs/content/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
navigation: false
3-
title: Comark
3+
title: Markdown + Components
44
description: A fast, streaming-ready markdown parser with component support for Vue, React, and Svelte.
55
seo:
6-
title: Components in Markdown
6+
title: Markdown + Components
77
description: Fast, streaming-ready markdown parser with Vue, React, and Svelte component support. Parse Comark content from strings or streams with TypeScript support.
88
ogImage: /social-card.jpg
99

1010
---
1111

1212
::landing-hero
1313
---
14-
title: Comark
15-
description: A fast, streaming-ready markdown parser with component support for Vue, React, Svelte, HTML and ANSI terminal.
14+
title: Markdown + Components
15+
description: Comark is a fast, streaming-ready markdown parser and renderer with component support for React, Svelte, Vue, HTML and ANSI terminal.
1616
install: npm install comark
1717
primaryLabel: Get Started
1818
primaryTo: /getting-started/introduction
@@ -26,7 +26,7 @@ demoMarkdown: |-
2626
## Features
2727

2828
- Parse markdown in real-time
29-
- Vue, React, and Svelte components
29+
- React, Svelte and Vue components
3030
- Auto-close incomplete syntax
3131

3232
::callout{color="info" icon="i-lucide-info"}
@@ -55,7 +55,7 @@ frameworksReactLinkLabel: React docs
5555
frameworksReactLinkTo: /rendering/react
5656
frameworksSvelteLinkLabel: Svelte docs
5757
frameworksSvelteLinkTo: /rendering/svelte
58-
frameworksTitle: Vue, React & Svelte
58+
frameworksTitle: React, Svelte & Vue
5959
frameworksVueLinkLabel: Vue docs
6060
frameworksVueLinkTo: /rendering/vue
6161
streamingDescription: Parse content as it arrives. Perfect for AI-generated

examples/1.frameworks/nuxt/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ navigation:
77
path: /examples/frameworks/nuxt-ui
88
---
99

10-
::CodeExplorer
10+
::code-explorer
1111
---
1212
org: comarkdown
13-
repo: comark
13+
repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
1414
path: examples/1.frameworks/nuxt
1515
defaultValue: content/posts/comark-syntax.md
1616
---

examples/3.plugins/vue-vite-binding/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ path: /examples/plugins/vue-vite-binding
1010
::code-explorer
1111
---
1212
org: comarkdown
13-
repo: comark
13+
repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
1414
path: examples/3.plugins/vue-vite-binding
1515
defaultValue: src/App.vue
1616
---

examples/3.plugins/vue-vite-json-render/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ path: /examples/plugins/vue-vite-json-render
1010
::code-explorer
1111
---
1212
org: comarkdown
13-
repo: comark
13+
repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
1414
path: examples/3.plugins/vue-vite-json-render
1515
defaultValue: src/App.vue
1616
---

examples/3.plugins/vue-vite-punctuation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ path: /examples/plugins/vue-vite-punctuation
1010
::code-explorer
1111
---
1212
org: comarkdown
13-
repo: comark
13+
repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
1414
path: examples/3.plugins/vue-vite-punctuation
1515
defaultValue: src/App.vue
1616
---

0 commit comments

Comments
 (0)