Skip to content

Commit bc65214

Browse files
committed
chore: upgrade minimark
1 parent 37900c8 commit bc65214

4 files changed

Lines changed: 193 additions & 13 deletions

File tree

docs/app/pages/play.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import { MDC } from 'mdc-syntax/vue'
2+
import { parseAsync } from 'mdc-syntax'
3+
import { MDCRenderer } from 'mdc-syntax/vue'
34
import mathPlugin from '@mdc-syntax/math'
45
import { Math } from '@mdc-syntax/math/vue'
56
@@ -49,27 +50,32 @@ graph TD
4950
E --> G
5051
\`\`\`
5152
`)
53+
54+
const { data } = useAsyncData('ast', () => parseAsync(markdown.value, { plugins: [mathPlugin] }), {
55+
watch: [markdown],
56+
})
5257
</script>
5358

5459
<template>
5560
<div
56-
class="grid grid-cols-2 gap-4 p-4"
61+
class="grid grid-cols-2 grid-rows-2 gap-1 bg-neutral-100 dark:bg-neutral-800"
5762
style="height: calc(100vh - 64px)"
5863
>
59-
<div class="w-full h-full overflow-y-auto border rounded">
64+
<div class="w-full h-full flex flex-col overflow-y-auto bg-white dark:bg-neutral-900">
6065
<textarea
6166
v-model="markdown"
6267
class="w-full h-full p-4 resize-none outline-none"
6368
placeholder="Enter markdown here..."
6469
/>
6570
</div>
6671

67-
<div class="w-full h-full overflow-y-auto p-4 border rounded prose prose-sm max-w-none">
68-
<MDC
69-
:markdown="markdown"
70-
:options="{ plugins: [mathPlugin] }"
72+
<div class="w-full h-full row-span-2 overflow-y-auto p-4 bg-white dark:bg-neutral-900">
73+
<MDCRenderer
74+
:body="data?.body"
7175
:components="{ math: Math }"
7276
/>
7377
</div>
78+
79+
<pre class="w-full h-full overflow-y-auto p-4 rounded font-mono text-sm max-w-none bg-white dark:bg-neutral-900">{{ JSON.stringify(data?.body, null, 2) }}</pre>
7480
</div>
7581
</template>
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
timeout:
3+
parse: 5ms
4+
html: 5ms
5+
markdown: 5ms
6+
options:
7+
autoUnwrap: true
8+
---
9+
10+
## Input
11+
12+
```md
13+
::page-section
14+
:::page-section
15+
#tagline
16+
{{ $doc.snippet.tagline }}
17+
18+
#title
19+
{{ $doc.snippet.title }}
20+
21+
#description
22+
{{ $doc.snippet.description }}
23+
24+
::::button{:to="$doc.snippet.link" appearance="primary"}
25+
Button Text
26+
::::
27+
28+
::::button{:to="$doc.snippet.link" appearance="primary"}
29+
Button Text
30+
::::
31+
32+
::::button
33+
---
34+
:data-testid: $doc.snippet.description
35+
external: true
36+
:to: $doc.snippet.link
37+
appearance: primary
38+
---
39+
Button Text
40+
::::
41+
:::
42+
::
43+
```
44+
45+
## AST
46+
47+
```json
48+
{
49+
"type": "minimark",
50+
"value": [
51+
[
52+
"page-section",
53+
{},
54+
[
55+
"page-section",
56+
{},
57+
[
58+
"template",
59+
{
60+
"name": "tagline"
61+
},
62+
"{{ $doc.snippet.tagline }}"
63+
],
64+
[
65+
"template",
66+
{
67+
"name": "title"
68+
},
69+
"{{ $doc.snippet.title }}"
70+
],
71+
[
72+
"template",
73+
{
74+
"name": "description"
75+
},
76+
[
77+
"p",
78+
{},
79+
"{{ $doc.snippet.description }}"
80+
],
81+
[
82+
"button",
83+
{
84+
":to": "$doc.snippet.link",
85+
"appearance": "primary"
86+
},
87+
"Button Text"
88+
],
89+
[
90+
"button",
91+
{
92+
":to": "$doc.snippet.link",
93+
"appearance": "primary"
94+
},
95+
"Button Text"
96+
],
97+
[
98+
"button",
99+
{
100+
":data-testid": "$doc.snippet.description",
101+
"external": "true",
102+
":to": "$doc.snippet.link",
103+
"appearance": "primary"
104+
},
105+
"Button Text"
106+
]
107+
]
108+
]
109+
]
110+
]
111+
}
112+
```
113+
114+
## HTML
115+
116+
```html
117+
<page-section>
118+
<page-section>
119+
<template name="tagline">
120+
{{ $doc.snippet.tagline }}
121+
</template>
122+
<template name="title">
123+
{{ $doc.snippet.title }}
124+
</template>
125+
<template name="description">
126+
<p>{{ $doc.snippet.description }}</p>
127+
<button to="$doc.snippet.link" appearance="primary">
128+
Button Text
129+
</button>
130+
<button to="$doc.snippet.link" appearance="primary">
131+
Button Text
132+
</button>
133+
<button data-testid="$doc.snippet.description" external="true" to="$doc.snippet.link" appearance="primary">
134+
Button Text
135+
</button>
136+
</template>
137+
</page-section>
138+
</page-section>
139+
```
140+
141+
## Markdown
142+
143+
```md
144+
::page-section
145+
:::page-section
146+
#tagline
147+
{{ $doc.snippet.tagline }}
148+
149+
#title
150+
{{ $doc.snippet.title }}
151+
152+
#description
153+
{{ $doc.snippet.description }}
154+
155+
::::button{:to="$doc.snippet.link" appearance="primary"}
156+
Button Text
157+
::::
158+
159+
::::button{:to="$doc.snippet.link" appearance="primary"}
160+
Button Text
161+
::::
162+
163+
::::button
164+
---
165+
:data-testid: $doc.snippet.description
166+
external: true
167+
:to: $doc.snippet.link
168+
appearance: primary
169+
---
170+
Button Text
171+
::::
172+
:::
173+
::
174+
```

packages/mdc-syntax/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dependencies": {
5252
"markdown-it": "^14.1.0",
5353
"markdown-it-mdc": "^0.2.9",
54-
"minimark": "https://pkg.pr.new/minimark@b2f64a8",
54+
"minimark": "https://pkg.pr.new/minimark@24c408f",
5555
"shiki": "^3.22.0",
5656
"shiki-stream": "^0.1.4",
5757
"yaml": "^2.8.2"

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)