@primeui-devkit/vue-markdown 0.1.0-rc.2 → 0.1.0-rc.4
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.
- package/README.md +0 -5
- package/THIRD-PARTY-NOTICES.txt +2 -2
- package/dist/index.d.ts +530 -0
- package/dist/index.js +1 -82
- package/package.json +33 -23
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/prose/ProseA.vue.js +0 -28
- package/dist/prose/ProseA2.vue.js +0 -4
- package/dist/prose/ProseBlockquote.vue.js +0 -12
- package/dist/prose/ProseCode.vue.js +0 -12
- package/dist/prose/ProseEm.vue.js +0 -12
- package/dist/prose/ProseH1.vue.js +0 -26
- package/dist/prose/ProseH12.vue.js +0 -4
- package/dist/prose/ProseH2.vue.js +0 -26
- package/dist/prose/ProseH22.vue.js +0 -4
- package/dist/prose/ProseH3.vue.js +0 -26
- package/dist/prose/ProseH32.vue.js +0 -4
- package/dist/prose/ProseH4.vue.js +0 -26
- package/dist/prose/ProseH42.vue.js +0 -4
- package/dist/prose/ProseH5.vue.js +0 -26
- package/dist/prose/ProseH52.vue.js +0 -4
- package/dist/prose/ProseH6.vue.js +0 -26
- package/dist/prose/ProseH62.vue.js +0 -4
- package/dist/prose/ProseHr.vue.js +0 -10
- package/dist/prose/ProseImg.vue.js +0 -35
- package/dist/prose/ProseImg2.vue.js +0 -4
- package/dist/prose/ProseLi.vue.js +0 -12
- package/dist/prose/ProseOl.vue.js +0 -12
- package/dist/prose/ProseP.vue.js +0 -12
- package/dist/prose/ProsePre.vue.js +0 -89
- package/dist/prose/ProsePre2.vue.js +0 -4
- package/dist/prose/ProseStrong.vue.js +0 -12
- package/dist/prose/ProseTable.vue.js +0 -14
- package/dist/prose/ProseTbody.vue.js +0 -12
- package/dist/prose/ProseTd.vue.js +0 -12
- package/dist/prose/ProseTh.vue.js +0 -12
- package/dist/prose/ProseThead.vue.js +0 -12
- package/dist/prose/ProseTr.vue.js +0 -12
- package/dist/prose/ProseUl.vue.js +0 -12
- package/types/index.d.ts +0 -30
package/README.md
CHANGED
|
@@ -15,8 +15,3 @@ const components = { ...proseComponents, 'demo-viewer': DemoViewer };
|
|
|
15
15
|
<MarkdownRenderer :tree="tree" :components="components" />
|
|
16
16
|
</template>
|
|
17
17
|
```
|
|
18
|
-
|
|
19
|
-
`Markdown` (parses a markdown string at runtime) and
|
|
20
|
-
`defineMarkdownComponent` / `defineMarkdownRenderer` (pre-configured factories)
|
|
21
|
-
are also exported. For Nuxt projects, `@primeui-devkit/nuxt-markdown` is the
|
|
22
|
-
recommended integration.
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -5,11 +5,11 @@ Each is provided under its own license, reproduced below.
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## @comark/vue 0.5.1
|
|
9
9
|
|
|
10
10
|
Copyright (c) 2026 Comark team and contributors
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
https://comark.dev/rendering/vue
|
|
13
13
|
|
|
14
14
|
Licensed under the MIT License.
|
|
15
15
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNode, DefineComponent } from 'vue';
|
|
3
|
+
import { MarkdownNode, MarkdownPlugin } from '@primeui-devkit/markdown-core';
|
|
4
|
+
import { SanitizeOptions } from '@primeui-devkit/markdown-core/plugins/sanitize';
|
|
5
|
+
export { SanitizeOptions } from '@primeui-devkit/markdown-core/plugins/sanitize';
|
|
6
|
+
|
|
7
|
+
type Manifest = (name: string) => unknown;
|
|
8
|
+
type Caret = boolean | {
|
|
9
|
+
class: string;
|
|
10
|
+
};
|
|
11
|
+
/** A tree as the renderer takes it: the parser's output, or any object with `nodes`. */
|
|
12
|
+
type MarkdownTreeInput = {
|
|
13
|
+
nodes: MarkdownNode[];
|
|
14
|
+
frontmatter?: Record<string, unknown>;
|
|
15
|
+
meta?: Record<string, unknown>;
|
|
16
|
+
} & Record<string, unknown>;
|
|
17
|
+
/** Renders a parsed tree, sanitized unless `sanitize: false`. Synchronous, so it needs no `<Suspense>`. */
|
|
18
|
+
declare const MarkdownRenderer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
19
|
+
/** The parsed tree to render. */
|
|
20
|
+
readonly tree: {
|
|
21
|
+
readonly type: PropType<MarkdownTreeInput | null>;
|
|
22
|
+
readonly default: null;
|
|
23
|
+
};
|
|
24
|
+
/** Removes what would run script, submit a form, restyle the page or swap in another component; `false` renders the tree as given. @default true */
|
|
25
|
+
readonly sanitize: {
|
|
26
|
+
readonly type: PropType<boolean | SanitizeOptions>;
|
|
27
|
+
readonly default: true;
|
|
28
|
+
};
|
|
29
|
+
/** Components by tag: `ProseA` replaces `a`, `demo-viewer` renders `::demo-viewer`. */
|
|
30
|
+
readonly components: {
|
|
31
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
32
|
+
readonly default: undefined;
|
|
33
|
+
};
|
|
34
|
+
/** Resolves a component the map does not have, possibly asynchronously. */
|
|
35
|
+
readonly componentsManifest: {
|
|
36
|
+
readonly type: PropType<Manifest>;
|
|
37
|
+
readonly default: undefined;
|
|
38
|
+
};
|
|
39
|
+
readonly streaming: {
|
|
40
|
+
readonly type: BooleanConstructor;
|
|
41
|
+
readonly default: false;
|
|
42
|
+
};
|
|
43
|
+
readonly caret: {
|
|
44
|
+
readonly type: PropType<Caret>;
|
|
45
|
+
readonly default: false;
|
|
46
|
+
};
|
|
47
|
+
/** Extra values `:bound` attributes may read as `data.*`. */
|
|
48
|
+
readonly data: {
|
|
49
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
50
|
+
readonly default: undefined;
|
|
51
|
+
};
|
|
52
|
+
/** Key of a live document in `globalThis.comarkContext`; the tree's own `meta.key` wins. */
|
|
53
|
+
readonly comarkKey: {
|
|
54
|
+
readonly type: StringConstructor;
|
|
55
|
+
readonly default: undefined;
|
|
56
|
+
};
|
|
57
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
60
|
+
/** The parsed tree to render. */
|
|
61
|
+
readonly tree: {
|
|
62
|
+
readonly type: PropType<MarkdownTreeInput | null>;
|
|
63
|
+
readonly default: null;
|
|
64
|
+
};
|
|
65
|
+
/** Removes what would run script, submit a form, restyle the page or swap in another component; `false` renders the tree as given. @default true */
|
|
66
|
+
readonly sanitize: {
|
|
67
|
+
readonly type: PropType<boolean | SanitizeOptions>;
|
|
68
|
+
readonly default: true;
|
|
69
|
+
};
|
|
70
|
+
/** Components by tag: `ProseA` replaces `a`, `demo-viewer` renders `::demo-viewer`. */
|
|
71
|
+
readonly components: {
|
|
72
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
73
|
+
readonly default: undefined;
|
|
74
|
+
};
|
|
75
|
+
/** Resolves a component the map does not have, possibly asynchronously. */
|
|
76
|
+
readonly componentsManifest: {
|
|
77
|
+
readonly type: PropType<Manifest>;
|
|
78
|
+
readonly default: undefined;
|
|
79
|
+
};
|
|
80
|
+
readonly streaming: {
|
|
81
|
+
readonly type: BooleanConstructor;
|
|
82
|
+
readonly default: false;
|
|
83
|
+
};
|
|
84
|
+
readonly caret: {
|
|
85
|
+
readonly type: PropType<Caret>;
|
|
86
|
+
readonly default: false;
|
|
87
|
+
};
|
|
88
|
+
/** Extra values `:bound` attributes may read as `data.*`. */
|
|
89
|
+
readonly data: {
|
|
90
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
91
|
+
readonly default: undefined;
|
|
92
|
+
};
|
|
93
|
+
/** Key of a live document in `globalThis.comarkContext`; the tree's own `meta.key` wins. */
|
|
94
|
+
readonly comarkKey: {
|
|
95
|
+
readonly type: StringConstructor;
|
|
96
|
+
readonly default: undefined;
|
|
97
|
+
};
|
|
98
|
+
}>> & Readonly<{}>, {
|
|
99
|
+
readonly data: Record<string, unknown>;
|
|
100
|
+
readonly components: Record<string, unknown>;
|
|
101
|
+
readonly tree: MarkdownTreeInput | null;
|
|
102
|
+
readonly sanitize: boolean | SanitizeOptions;
|
|
103
|
+
readonly componentsManifest: Manifest;
|
|
104
|
+
readonly streaming: boolean;
|
|
105
|
+
readonly caret: Caret;
|
|
106
|
+
readonly comarkKey: string;
|
|
107
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
108
|
+
|
|
109
|
+
interface MarkdownRendererOptions {
|
|
110
|
+
name?: string;
|
|
111
|
+
/** Components merged under the ones passed as a prop. */
|
|
112
|
+
components?: Record<string, unknown>;
|
|
113
|
+
/** The default for the `sanitize` prop. @default true */
|
|
114
|
+
sanitize?: boolean | SanitizeOptions;
|
|
115
|
+
class?: string;
|
|
116
|
+
}
|
|
117
|
+
/** A `MarkdownRenderer` with components and a sanitize setting built in; the props still override them. */
|
|
118
|
+
declare function defineMarkdownRenderer(config?: MarkdownRendererOptions): vue.DefineComponent<vue.ExtractPropTypes<{
|
|
119
|
+
sanitize: {
|
|
120
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
tree: {
|
|
124
|
+
readonly type: PropType<MarkdownTreeInput | null>;
|
|
125
|
+
readonly default: null;
|
|
126
|
+
};
|
|
127
|
+
components: {
|
|
128
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
129
|
+
readonly default: undefined;
|
|
130
|
+
};
|
|
131
|
+
componentsManifest: {
|
|
132
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
133
|
+
readonly default: undefined;
|
|
134
|
+
};
|
|
135
|
+
streaming: {
|
|
136
|
+
readonly type: BooleanConstructor;
|
|
137
|
+
readonly default: false;
|
|
138
|
+
};
|
|
139
|
+
caret: {
|
|
140
|
+
readonly type: PropType<boolean | {
|
|
141
|
+
class: string;
|
|
142
|
+
}>;
|
|
143
|
+
readonly default: false;
|
|
144
|
+
};
|
|
145
|
+
data: {
|
|
146
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
147
|
+
readonly default: undefined;
|
|
148
|
+
};
|
|
149
|
+
comarkKey: {
|
|
150
|
+
readonly type: StringConstructor;
|
|
151
|
+
readonly default: undefined;
|
|
152
|
+
};
|
|
153
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
154
|
+
[key: string]: any;
|
|
155
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
156
|
+
sanitize: {
|
|
157
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
158
|
+
default: undefined;
|
|
159
|
+
};
|
|
160
|
+
tree: {
|
|
161
|
+
readonly type: PropType<MarkdownTreeInput | null>;
|
|
162
|
+
readonly default: null;
|
|
163
|
+
};
|
|
164
|
+
components: {
|
|
165
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
166
|
+
readonly default: undefined;
|
|
167
|
+
};
|
|
168
|
+
componentsManifest: {
|
|
169
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
170
|
+
readonly default: undefined;
|
|
171
|
+
};
|
|
172
|
+
streaming: {
|
|
173
|
+
readonly type: BooleanConstructor;
|
|
174
|
+
readonly default: false;
|
|
175
|
+
};
|
|
176
|
+
caret: {
|
|
177
|
+
readonly type: PropType<boolean | {
|
|
178
|
+
class: string;
|
|
179
|
+
}>;
|
|
180
|
+
readonly default: false;
|
|
181
|
+
};
|
|
182
|
+
data: {
|
|
183
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
184
|
+
readonly default: undefined;
|
|
185
|
+
};
|
|
186
|
+
comarkKey: {
|
|
187
|
+
readonly type: StringConstructor;
|
|
188
|
+
readonly default: undefined;
|
|
189
|
+
};
|
|
190
|
+
}>> & Readonly<{}>, {
|
|
191
|
+
data: Record<string, unknown>;
|
|
192
|
+
components: Record<string, unknown>;
|
|
193
|
+
tree: MarkdownTreeInput | null;
|
|
194
|
+
sanitize: boolean | SanitizeOptions;
|
|
195
|
+
componentsManifest: (name: string) => unknown;
|
|
196
|
+
streaming: boolean;
|
|
197
|
+
caret: boolean | {
|
|
198
|
+
class: string;
|
|
199
|
+
};
|
|
200
|
+
comarkKey: string;
|
|
201
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
202
|
+
|
|
203
|
+
interface MarkdownComponentOptions extends MarkdownRendererOptions {
|
|
204
|
+
/** Plugins that run before the sanitizer, ahead of any passed as a prop. */
|
|
205
|
+
plugins?: MarkdownPlugin<any, any>[];
|
|
206
|
+
/** Parser options, under any passed as a prop. */
|
|
207
|
+
options?: Record<string, unknown>;
|
|
208
|
+
}
|
|
209
|
+
/** A component that parses markdown at runtime. Parsing is asynchronous, so outside Nuxt it renders inside `<Suspense>`. */
|
|
210
|
+
declare function defineMarkdownComponent(config?: MarkdownComponentOptions): vue.DefineComponent<vue.ExtractPropTypes<{
|
|
211
|
+
markdown: {
|
|
212
|
+
type: StringConstructor;
|
|
213
|
+
default: undefined;
|
|
214
|
+
};
|
|
215
|
+
/** Parser options. */
|
|
216
|
+
options: {
|
|
217
|
+
type: PropType<Record<string, unknown>>;
|
|
218
|
+
default: undefined;
|
|
219
|
+
};
|
|
220
|
+
/** Plugins that run after the built-in ones and before the sanitizer. */
|
|
221
|
+
plugins: {
|
|
222
|
+
type: PropType<MarkdownPlugin<any, any>[]>;
|
|
223
|
+
default: undefined;
|
|
224
|
+
};
|
|
225
|
+
components: {
|
|
226
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
227
|
+
readonly default: undefined;
|
|
228
|
+
};
|
|
229
|
+
componentsManifest: {
|
|
230
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
231
|
+
readonly default: undefined;
|
|
232
|
+
};
|
|
233
|
+
sanitize: {
|
|
234
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
235
|
+
default: undefined;
|
|
236
|
+
};
|
|
237
|
+
streaming: {
|
|
238
|
+
readonly type: BooleanConstructor;
|
|
239
|
+
readonly default: false;
|
|
240
|
+
};
|
|
241
|
+
/** Renders only what comes before a `<!-- more -->` comment. */
|
|
242
|
+
summary: {
|
|
243
|
+
type: BooleanConstructor;
|
|
244
|
+
default: boolean;
|
|
245
|
+
};
|
|
246
|
+
caret: {
|
|
247
|
+
readonly type: PropType<boolean | {
|
|
248
|
+
class: string;
|
|
249
|
+
}>;
|
|
250
|
+
readonly default: false;
|
|
251
|
+
};
|
|
252
|
+
data: {
|
|
253
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
254
|
+
readonly default: undefined;
|
|
255
|
+
};
|
|
256
|
+
}>, () => VNode, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
257
|
+
markdown: {
|
|
258
|
+
type: StringConstructor;
|
|
259
|
+
default: undefined;
|
|
260
|
+
};
|
|
261
|
+
/** Parser options. */
|
|
262
|
+
options: {
|
|
263
|
+
type: PropType<Record<string, unknown>>;
|
|
264
|
+
default: undefined;
|
|
265
|
+
};
|
|
266
|
+
/** Plugins that run after the built-in ones and before the sanitizer. */
|
|
267
|
+
plugins: {
|
|
268
|
+
type: PropType<MarkdownPlugin<any, any>[]>;
|
|
269
|
+
default: undefined;
|
|
270
|
+
};
|
|
271
|
+
components: {
|
|
272
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
273
|
+
readonly default: undefined;
|
|
274
|
+
};
|
|
275
|
+
componentsManifest: {
|
|
276
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
277
|
+
readonly default: undefined;
|
|
278
|
+
};
|
|
279
|
+
sanitize: {
|
|
280
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
281
|
+
default: undefined;
|
|
282
|
+
};
|
|
283
|
+
streaming: {
|
|
284
|
+
readonly type: BooleanConstructor;
|
|
285
|
+
readonly default: false;
|
|
286
|
+
};
|
|
287
|
+
/** Renders only what comes before a `<!-- more -->` comment. */
|
|
288
|
+
summary: {
|
|
289
|
+
type: BooleanConstructor;
|
|
290
|
+
default: boolean;
|
|
291
|
+
};
|
|
292
|
+
caret: {
|
|
293
|
+
readonly type: PropType<boolean | {
|
|
294
|
+
class: string;
|
|
295
|
+
}>;
|
|
296
|
+
readonly default: false;
|
|
297
|
+
};
|
|
298
|
+
data: {
|
|
299
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
300
|
+
readonly default: undefined;
|
|
301
|
+
};
|
|
302
|
+
}>> & Readonly<{}>, {
|
|
303
|
+
data: Record<string, unknown>;
|
|
304
|
+
summary: boolean;
|
|
305
|
+
components: Record<string, unknown>;
|
|
306
|
+
sanitize: boolean | SanitizeOptions;
|
|
307
|
+
componentsManifest: (name: string) => unknown;
|
|
308
|
+
streaming: boolean;
|
|
309
|
+
caret: boolean | {
|
|
310
|
+
class: string;
|
|
311
|
+
};
|
|
312
|
+
plugins: MarkdownPlugin<any, any>[];
|
|
313
|
+
options: Record<string, unknown>;
|
|
314
|
+
markdown: string;
|
|
315
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
316
|
+
/** Parses markdown at runtime into sanitized output. Asynchronous: outside Nuxt, render it inside `<Suspense>`. */
|
|
317
|
+
declare const Markdown: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
318
|
+
markdown: {
|
|
319
|
+
type: StringConstructor;
|
|
320
|
+
default: undefined;
|
|
321
|
+
};
|
|
322
|
+
/** Parser options. */
|
|
323
|
+
options: {
|
|
324
|
+
type: PropType<Record<string, unknown>>;
|
|
325
|
+
default: undefined;
|
|
326
|
+
};
|
|
327
|
+
/** Plugins that run after the built-in ones and before the sanitizer. */
|
|
328
|
+
plugins: {
|
|
329
|
+
type: PropType<MarkdownPlugin<any, any>[]>;
|
|
330
|
+
default: undefined;
|
|
331
|
+
};
|
|
332
|
+
components: {
|
|
333
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
334
|
+
readonly default: undefined;
|
|
335
|
+
};
|
|
336
|
+
componentsManifest: {
|
|
337
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
338
|
+
readonly default: undefined;
|
|
339
|
+
};
|
|
340
|
+
sanitize: {
|
|
341
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
342
|
+
default: undefined;
|
|
343
|
+
};
|
|
344
|
+
streaming: {
|
|
345
|
+
readonly type: BooleanConstructor;
|
|
346
|
+
readonly default: false;
|
|
347
|
+
};
|
|
348
|
+
/** Renders only what comes before a `<!-- more -->` comment. */
|
|
349
|
+
summary: {
|
|
350
|
+
type: BooleanConstructor;
|
|
351
|
+
default: boolean;
|
|
352
|
+
};
|
|
353
|
+
caret: {
|
|
354
|
+
readonly type: PropType<boolean | {
|
|
355
|
+
class: string;
|
|
356
|
+
}>;
|
|
357
|
+
readonly default: false;
|
|
358
|
+
};
|
|
359
|
+
data: {
|
|
360
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
361
|
+
readonly default: undefined;
|
|
362
|
+
};
|
|
363
|
+
}>, () => VNode, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
364
|
+
markdown: {
|
|
365
|
+
type: StringConstructor;
|
|
366
|
+
default: undefined;
|
|
367
|
+
};
|
|
368
|
+
/** Parser options. */
|
|
369
|
+
options: {
|
|
370
|
+
type: PropType<Record<string, unknown>>;
|
|
371
|
+
default: undefined;
|
|
372
|
+
};
|
|
373
|
+
/** Plugins that run after the built-in ones and before the sanitizer. */
|
|
374
|
+
plugins: {
|
|
375
|
+
type: PropType<MarkdownPlugin<any, any>[]>;
|
|
376
|
+
default: undefined;
|
|
377
|
+
};
|
|
378
|
+
components: {
|
|
379
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
380
|
+
readonly default: undefined;
|
|
381
|
+
};
|
|
382
|
+
componentsManifest: {
|
|
383
|
+
readonly type: PropType<(name: string) => unknown>;
|
|
384
|
+
readonly default: undefined;
|
|
385
|
+
};
|
|
386
|
+
sanitize: {
|
|
387
|
+
type: PropType<boolean | SanitizeOptions>;
|
|
388
|
+
default: undefined;
|
|
389
|
+
};
|
|
390
|
+
streaming: {
|
|
391
|
+
readonly type: BooleanConstructor;
|
|
392
|
+
readonly default: false;
|
|
393
|
+
};
|
|
394
|
+
/** Renders only what comes before a `<!-- more -->` comment. */
|
|
395
|
+
summary: {
|
|
396
|
+
type: BooleanConstructor;
|
|
397
|
+
default: boolean;
|
|
398
|
+
};
|
|
399
|
+
caret: {
|
|
400
|
+
readonly type: PropType<boolean | {
|
|
401
|
+
class: string;
|
|
402
|
+
}>;
|
|
403
|
+
readonly default: false;
|
|
404
|
+
};
|
|
405
|
+
data: {
|
|
406
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
407
|
+
readonly default: undefined;
|
|
408
|
+
};
|
|
409
|
+
}>> & Readonly<{}>, {
|
|
410
|
+
data: Record<string, unknown>;
|
|
411
|
+
summary: boolean;
|
|
412
|
+
components: Record<string, unknown>;
|
|
413
|
+
sanitize: boolean | SanitizeOptions;
|
|
414
|
+
componentsManifest: (name: string) => unknown;
|
|
415
|
+
streaming: boolean;
|
|
416
|
+
caret: boolean | {
|
|
417
|
+
class: string;
|
|
418
|
+
};
|
|
419
|
+
plugins: MarkdownPlugin<any, any>[];
|
|
420
|
+
options: Record<string, unknown>;
|
|
421
|
+
markdown: string;
|
|
422
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
423
|
+
|
|
424
|
+
declare const ProseA: DefineComponent<{
|
|
425
|
+
href?: string;
|
|
426
|
+
target?: string;
|
|
427
|
+
}>;
|
|
428
|
+
declare const ProseBlockquote: DefineComponent<Record<string, never>>;
|
|
429
|
+
declare const ProseCode: DefineComponent<Record<string, never>>;
|
|
430
|
+
declare const ProseEm: DefineComponent<Record<string, never>>;
|
|
431
|
+
declare const ProseH1: DefineComponent<{
|
|
432
|
+
id?: string;
|
|
433
|
+
}>;
|
|
434
|
+
declare const ProseH2: DefineComponent<{
|
|
435
|
+
id?: string;
|
|
436
|
+
}>;
|
|
437
|
+
declare const ProseH3: DefineComponent<{
|
|
438
|
+
id?: string;
|
|
439
|
+
}>;
|
|
440
|
+
declare const ProseH4: DefineComponent<{
|
|
441
|
+
id?: string;
|
|
442
|
+
}>;
|
|
443
|
+
declare const ProseH5: DefineComponent<{
|
|
444
|
+
id?: string;
|
|
445
|
+
}>;
|
|
446
|
+
declare const ProseH6: DefineComponent<{
|
|
447
|
+
id?: string;
|
|
448
|
+
}>;
|
|
449
|
+
declare const ProseHr: DefineComponent<Record<string, never>>;
|
|
450
|
+
declare const ProseImg: DefineComponent<{
|
|
451
|
+
src?: string;
|
|
452
|
+
alt?: string;
|
|
453
|
+
width?: string | number;
|
|
454
|
+
height?: string | number;
|
|
455
|
+
}>;
|
|
456
|
+
declare const ProseLi: DefineComponent<Record<string, never>>;
|
|
457
|
+
declare const ProseOl: DefineComponent<Record<string, never>>;
|
|
458
|
+
declare const ProseP: DefineComponent<Record<string, never>>;
|
|
459
|
+
declare const ProsePre: DefineComponent<{
|
|
460
|
+
code?: string;
|
|
461
|
+
language?: string;
|
|
462
|
+
filename?: string;
|
|
463
|
+
highlights?: number[];
|
|
464
|
+
meta?: string;
|
|
465
|
+
class?: string;
|
|
466
|
+
}>;
|
|
467
|
+
declare const ProseStrong: DefineComponent<Record<string, never>>;
|
|
468
|
+
declare const ProseTable: DefineComponent<Record<string, never>>;
|
|
469
|
+
declare const ProseTbody: DefineComponent<Record<string, never>>;
|
|
470
|
+
declare const ProseTd: DefineComponent<Record<string, never>>;
|
|
471
|
+
declare const ProseTh: DefineComponent<Record<string, never>>;
|
|
472
|
+
declare const ProseThead: DefineComponent<Record<string, never>>;
|
|
473
|
+
declare const ProseTr: DefineComponent<Record<string, never>>;
|
|
474
|
+
declare const ProseUl: DefineComponent<Record<string, never>>;
|
|
475
|
+
declare const proseComponents: {
|
|
476
|
+
ProseA: DefineComponent<{
|
|
477
|
+
href?: string;
|
|
478
|
+
target?: string;
|
|
479
|
+
}>;
|
|
480
|
+
ProseBlockquote: DefineComponent<Record<string, never>>;
|
|
481
|
+
ProseCode: DefineComponent<Record<string, never>>;
|
|
482
|
+
ProseEm: DefineComponent<Record<string, never>>;
|
|
483
|
+
ProseH1: DefineComponent<{
|
|
484
|
+
id?: string;
|
|
485
|
+
}>;
|
|
486
|
+
ProseH2: DefineComponent<{
|
|
487
|
+
id?: string;
|
|
488
|
+
}>;
|
|
489
|
+
ProseH3: DefineComponent<{
|
|
490
|
+
id?: string;
|
|
491
|
+
}>;
|
|
492
|
+
ProseH4: DefineComponent<{
|
|
493
|
+
id?: string;
|
|
494
|
+
}>;
|
|
495
|
+
ProseH5: DefineComponent<{
|
|
496
|
+
id?: string;
|
|
497
|
+
}>;
|
|
498
|
+
ProseH6: DefineComponent<{
|
|
499
|
+
id?: string;
|
|
500
|
+
}>;
|
|
501
|
+
ProseHr: DefineComponent<Record<string, never>>;
|
|
502
|
+
ProseImg: DefineComponent<{
|
|
503
|
+
src?: string;
|
|
504
|
+
alt?: string;
|
|
505
|
+
width?: string | number;
|
|
506
|
+
height?: string | number;
|
|
507
|
+
}>;
|
|
508
|
+
ProseLi: DefineComponent<Record<string, never>>;
|
|
509
|
+
ProseOl: DefineComponent<Record<string, never>>;
|
|
510
|
+
ProseP: DefineComponent<Record<string, never>>;
|
|
511
|
+
ProsePre: DefineComponent<{
|
|
512
|
+
code?: string;
|
|
513
|
+
language?: string;
|
|
514
|
+
filename?: string;
|
|
515
|
+
highlights?: number[];
|
|
516
|
+
meta?: string;
|
|
517
|
+
class?: string;
|
|
518
|
+
}>;
|
|
519
|
+
ProseStrong: DefineComponent<Record<string, never>>;
|
|
520
|
+
ProseTable: DefineComponent<Record<string, never>>;
|
|
521
|
+
ProseTbody: DefineComponent<Record<string, never>>;
|
|
522
|
+
ProseTd: DefineComponent<Record<string, never>>;
|
|
523
|
+
ProseTh: DefineComponent<Record<string, never>>;
|
|
524
|
+
ProseThead: DefineComponent<Record<string, never>>;
|
|
525
|
+
ProseTr: DefineComponent<Record<string, never>>;
|
|
526
|
+
ProseUl: DefineComponent<Record<string, never>>;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
export { Markdown, MarkdownRenderer, ProseA, ProseBlockquote, ProseCode, ProseEm, ProseH1, ProseH2, ProseH3, ProseH4, ProseH5, ProseH6, ProseHr, ProseImg, ProseLi, ProseOl, ProseP, ProsePre, ProseStrong, ProseTable, ProseTbody, ProseTd, ProseTh, ProseThead, ProseTr, ProseUl, defineMarkdownComponent, defineMarkdownRenderer, proseComponents };
|
|
530
|
+
export type { MarkdownComponentOptions, MarkdownRendererOptions, MarkdownTreeInput };
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1 @@
|
|
|
1
|
-
import { Comark as X, ComarkRenderer as Y, defineComarkComponent as Z, defineComarkRendererComponent as oo } from "@comark/vue";
|
|
2
|
-
import o from "./prose/ProseA.vue.js";
|
|
3
|
-
import r from "./prose/ProseBlockquote.vue.js";
|
|
4
|
-
import m from "./prose/ProseCode.vue.js";
|
|
5
|
-
import e from "./prose/ProseEm.vue.js";
|
|
6
|
-
import s from "./prose/ProseH1.vue.js";
|
|
7
|
-
import f from "./prose/ProseH2.vue.js";
|
|
8
|
-
import i from "./prose/ProseH3.vue.js";
|
|
9
|
-
import P from "./prose/ProseH4.vue.js";
|
|
10
|
-
import t from "./prose/ProseH5.vue.js";
|
|
11
|
-
import a from "./prose/ProseH6.vue.js";
|
|
12
|
-
import n from "./prose/ProseHr.vue.js";
|
|
13
|
-
import p from "./prose/ProseImg.vue.js";
|
|
14
|
-
import _ from "./prose/ProseLi.vue.js";
|
|
15
|
-
import d from "./prose/ProseOl.vue.js";
|
|
16
|
-
import H from "./prose/ProseP.vue.js";
|
|
17
|
-
import c from "./prose/ProsePre.vue.js";
|
|
18
|
-
import k from "./prose/ProseStrong.vue.js";
|
|
19
|
-
import C from "./prose/ProseTable.vue.js";
|
|
20
|
-
import $ from "./prose/ProseTbody.vue.js";
|
|
21
|
-
import T from "./prose/ProseTd.vue.js";
|
|
22
|
-
import l from "./prose/ProseTh.vue.js";
|
|
23
|
-
import w from "./prose/ProseThead.vue.js";
|
|
24
|
-
import M from "./prose/ProseTr.vue.js";
|
|
25
|
-
import R from "./prose/ProseUl.vue.js";
|
|
26
|
-
const Q = {
|
|
27
|
-
ProseA: o,
|
|
28
|
-
ProseBlockquote: r,
|
|
29
|
-
ProseCode: m,
|
|
30
|
-
ProseEm: e,
|
|
31
|
-
ProseH1: s,
|
|
32
|
-
ProseH2: f,
|
|
33
|
-
ProseH3: i,
|
|
34
|
-
ProseH4: P,
|
|
35
|
-
ProseH5: t,
|
|
36
|
-
ProseH6: a,
|
|
37
|
-
ProseHr: n,
|
|
38
|
-
ProseImg: p,
|
|
39
|
-
ProseLi: _,
|
|
40
|
-
ProseOl: d,
|
|
41
|
-
ProseP: H,
|
|
42
|
-
ProsePre: c,
|
|
43
|
-
ProseStrong: k,
|
|
44
|
-
ProseTable: C,
|
|
45
|
-
ProseTbody: $,
|
|
46
|
-
ProseTd: T,
|
|
47
|
-
ProseTh: l,
|
|
48
|
-
ProseThead: w,
|
|
49
|
-
ProseTr: M,
|
|
50
|
-
ProseUl: R
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
X as Markdown,
|
|
54
|
-
Y as MarkdownRenderer,
|
|
55
|
-
o as ProseA,
|
|
56
|
-
r as ProseBlockquote,
|
|
57
|
-
m as ProseCode,
|
|
58
|
-
e as ProseEm,
|
|
59
|
-
s as ProseH1,
|
|
60
|
-
f as ProseH2,
|
|
61
|
-
i as ProseH3,
|
|
62
|
-
P as ProseH4,
|
|
63
|
-
t as ProseH5,
|
|
64
|
-
a as ProseH6,
|
|
65
|
-
n as ProseHr,
|
|
66
|
-
p as ProseImg,
|
|
67
|
-
_ as ProseLi,
|
|
68
|
-
d as ProseOl,
|
|
69
|
-
H as ProseP,
|
|
70
|
-
c as ProsePre,
|
|
71
|
-
k as ProseStrong,
|
|
72
|
-
C as ProseTable,
|
|
73
|
-
$ as ProseTbody,
|
|
74
|
-
T as ProseTd,
|
|
75
|
-
l as ProseTh,
|
|
76
|
-
w as ProseThead,
|
|
77
|
-
M as ProseTr,
|
|
78
|
-
R as ProseUl,
|
|
79
|
-
Z as defineMarkdownComponent,
|
|
80
|
-
oo as defineMarkdownRenderer,
|
|
81
|
-
Q as proseComponents
|
|
82
|
-
};
|
|
1
|
+
import{createMarkdownParser as e,pascalCase as t,resolveAttributes as n}from"@primeui-devkit/markdown-core";import r,{allowsGlobalComponent as i,componentMap as a,sanitizeOptions as o,sanitizeTree as s}from"@primeui-devkit/markdown-core/plugins/sanitize";import{computed as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,defineAsyncComponent as f,defineComponent as p,getCurrentInstance as m,h,inject as g,normalizeClass as _,onErrorCaptured as ee,onMounted as te,openBlock as v,ref as ne,renderSlot as y,shallowRef as b,toDisplayString as re,toRaw as x,watch as S}from"vue";const C=(e,t)=>e&&Object.hasOwn(e,t)?e[t]:void 0,w=/* @__PURE__ */ new WeakMap;function ie(e,t){let n=w.get(t);if(n||w.set(t,n=/* @__PURE__ */ new Map),!n.has(e)){let r=t(e);r&&typeof r.then==`function`?n.set(e,f(()=>r)):r&&n.set(e,r&&typeof r==`object`&&`default`in r?r.default:r)}return n.get(e)}function T(e,n,r,i,a){let o=t(e),s=`Prose${o}`;return C(n,s)||C(n,e)||C(n,o)||C(i,s)||(a(e)?C(i,o):void 0)||(r?ie(e,r):void 0)}function ae(e){return e?[`span`,{key:`stream-caret`,style:`background-color: currentColor; display: inline-block; margin-left: 0.25rem; margin-right: 0.25rem; animation: pulse 0.75s cubic-bezier(0.4,0,0.6,1) infinite;`,...typeof e==`object`&&e.class?{class:e.class}:{}},` `]:null}function E(e,t){if(Array.isArray(e))for(let n=e.length-1;n>=2;n--){let r=e[n];if(typeof r==`string`)return[...e,t];let i=E(r,t);if(i)return[...e.slice(0,n),i,...e.slice(n+1)]}}function D(e,t,r,i,a){if(typeof e==`string`)return e;if(!Array.isArray(e))return null;let[o,s={},...c]=e;if(typeof o!=`string`)return null;let l;i?.[0]!==`pre`&&(typeof s.as==`string`&&(l=T(s.as,t.components,t.manifest,t.app,t.allowGlobal)),l||=T(o,t.components,t.manifest,t.app,t.allowGlobal));let u=n(s,a,{parseJson:!0}),d={};for(let e in u){let t=e===`className`?`class`:e,n=u[e];l||t===`class`||t===`style`?d[t]=n:n!==!1&&n!=null&&(d[`^${t}`]=n===!0?``:n)}let f=l??{};(f.props?.__node||f.__asyncResolved?.props?.__node)&&(d.__node=e),r!==void 0&&(d.key=r);let p=l??o;if(c.length===0)return h(p,d);let m=Object.keys(u).length>0?{...a,props:d}:a,g={},_=[];return c.forEach((n,r)=>{if(n==null)return;if(Array.isArray(n)&&n[0]===`template`){let r=n[1]??{},i=typeof r.name==`string`?r.name:Object.keys(r).find(e=>e.startsWith(`v-slot:`))?.slice(7);if(i){let r=n.slice(2);g[i]=()=>r.map((n,r)=>D(n,t,r,e,m)).filter(e=>e!==null);return}}let i=D(n,t,r,e,m);i!==null&&_.push(i)}),l?(_.length>0&&(g.default=()=>_),h(p,d,g)):h(p,d,_)}const O={tree:{type:Object,default:null},sanitize:{type:[Boolean,Object],default:!0},components:{type:Object,default:void 0},componentsManifest:{type:Function,default:void 0},streaming:{type:Boolean,default:!1},caret:{type:[Boolean,Object],default:!1},data:{type:Object,default:void 0},comarkKey:{type:String,default:void 0}},k=p({name:`MarkdownRenderer`,props:O,setup(e){let t=b(null),n=g(`comark`,null),r=m()?.appContext.components;te(()=>{S(()=>e.tree?.meta?.key||e.comarkKey,(n,r,i)=>{let a=globalThis.comarkContext;if(t.value=null,!n||!a||!e.tree)return;let o=a.get(n,x(e.tree)).listen(e=>t.value=e);i(()=>o(!0))},{immediate:!0})}),ee(()=>!1);let l=c(()=>{let n=x(t.value??e.tree),r=o(e.sanitize);return n&&r?s(n,r):n}),u=c(()=>({components:a({...n?.components,...e.components}),manifest:t=>e.componentsManifest?.(t)||n?.componentManifest?.(t)||null,app:r,allowGlobal:t=>i(e.sanitize,t)}));return()=>{let t=l.value,n=[...t?.nodes??[]],r=e.streaming?ae(e.caret):null;if(r&&n.length>0){let e=E(n[n.length-1],r);n=e?[...n.slice(0,-1),e]:[...n,r]}let i={frontmatter:t?.frontmatter??t?.data??{},meta:t?.meta??{},data:e.data??{},props:{}};return h(`div`,{class:`comark-content markdown-content prose`},n.map((e,t)=>D(e,u.value,t,void 0,i)).filter(e=>e!==null))}}});function oe(e={}){return p({name:e.name??`MarkdownRenderer`,props:{...O,sanitize:{type:[Boolean,Object],default:void 0}},setup(t,{slots:n}){return()=>h(k,{...t,class:e.class,sanitize:t.sanitize??e.sanitize??!0,components:{...e.components,...t.components}},n)}})}function A(t={}){return p({name:t.name??`Markdown`,props:{markdown:{type:String,default:void 0},options:{type:Object,default:void 0},plugins:{type:Array,default:void 0},components:O.components,componentsManifest:O.componentsManifest,sanitize:{type:[Boolean,Object],default:void 0},streaming:O.streaming,summary:{type:Boolean,default:!1},caret:O.caret,data:O.data},async setup(n,{slots:i}){let a=c(()=>n.sanitize??t.sanitize??!0),s=c(()=>{let e=i.default?.()[0]?.children,t=typeof e==`string`?e:n.markdown??``;return(n.summary?t.split(`<!-- more -->`)[0]??``:t).trim()}),l=c(()=>{let i=o(a.value);return e({...t.options,...n.options,plugins:[...t.plugins??[],...n.plugins??[],...i?[r(i)]:[]]})}),u=b(null),d=0,f=async()=>{let e=++d,t=await l.value(s.value,{streaming:n.streaming});e===d&&(u.value=t)};return S([s,l,()=>n.streaming],f),await f(),()=>h(k,{tree:u.value,sanitize:a.value,components:{...t.components,...n.components},componentsManifest:n.componentsManifest,streaming:n.streaming,caret:n.caret,data:n.data,class:[t.class,n.streaming?`comark-stream`:void 0]})}})}const se=A({name:`Markdown`}),ce=[`href`,`target`],le=/*@__PURE__*/ p({__name:`ProseA`,props:{href:{type:String,default:``},target:{type:String,default:void 0,required:!1}},setup(e){let t=e;return(e,n)=>(v(),u(`a`,{class:`prose-a`,href:t.href,target:t.target},[y(e.$slots,`default`)],8,ce))}});var j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};const ue={},de={class:`prose-blockquote`};function fe(e,t){return v(),u(`blockquote`,de,[y(e.$slots,`default`)])}var pe=/*#__PURE__*/ j(ue,[[`render`,fe]]);const me={},he={class:`prose-code`};function ge(e,t){return v(),u(`code`,he,[y(e.$slots,`default`)])}var _e=/*#__PURE__*/ j(me,[[`render`,ge]]);const ve={},ye={class:`prose-em`};function be(e,t){return v(),u(`em`,ye,[y(e.$slots,`default`)])}var xe=/*#__PURE__*/ j(ve,[[`render`,be]]);const Se=[`id`],Ce=[`href`],we=/*@__PURE__*/ p({__name:`ProseH1`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h1`,{id:t.id,class:`prose-h1`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,Ce)):y(e.$slots,`default`,{},void 0,void 0,1)],8,Se))}}),Te=[`id`],Ee=[`href`],De=/*@__PURE__*/ p({__name:`ProseH2`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h2`,{id:t.id,class:`prose-h2`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,Ee)):y(e.$slots,`default`,{},void 0,void 0,1)],8,Te))}}),Oe=[`id`],ke=[`href`],Ae=/*@__PURE__*/ p({__name:`ProseH3`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h3`,{id:t.id,class:`prose-h3`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,ke)):y(e.$slots,`default`,{},void 0,void 0,1)],8,Oe))}}),je=[`id`],Me=[`href`],Ne=/*@__PURE__*/ p({__name:`ProseH4`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h4`,{id:t.id,class:`prose-h4`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,Me)):y(e.$slots,`default`,{},void 0,void 0,1)],8,je))}}),Pe=[`id`],Fe=[`href`],Ie=/*@__PURE__*/ p({__name:`ProseH5`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h5`,{id:t.id,class:`prose-h5`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,Fe)):y(e.$slots,`default`,{},void 0,void 0,1)],8,Pe))}}),Le=[`id`],Re=[`href`],ze=/*@__PURE__*/ p({__name:`ProseH6`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=c(()=>!!t.id);return(e,r)=>(v(),u(`h6`,{id:t.id,class:`prose-h6`},[t.id&&n.value?(v(),u(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=d(`span`,{class:`prose-heading-anchor`},`#`,-1),y(e.$slots,`default`)],8,Re)):y(e.$slots,`default`,{},void 0,void 0,1)],8,Le))}}),Be={},Ve={class:`prose-hr`};function He(e,t){return v(),u(`hr`,Ve)}var Ue=/*#__PURE__*/ j(Be,[[`render`,He]]);const We=[`src`,`alt`,`width`,`height`],Ge=/*@__PURE__*/ p({__name:`ProseImg`,props:{src:{type:String,default:``},alt:{type:String,default:``},width:{type:[String,Number],default:void 0},height:{type:[String,Number],default:void 0}},setup(e){let t=e;return(e,n)=>(v(),u(`img`,{class:`prose-img`,src:t.src,alt:t.alt,width:t.width,height:t.height},null,8,We))}}),Ke={},qe={class:`prose-li`};function Je(e,t){return v(),u(`li`,qe,[y(e.$slots,`default`)])}var Ye=/*#__PURE__*/ j(Ke,[[`render`,Je]]);const Xe={},Ze={class:`prose-ol`};function Qe(e,t){return v(),u(`ol`,Ze,[y(e.$slots,`default`)])}var $e=/*#__PURE__*/ j(Xe,[[`render`,Qe]]);const et={},tt={class:`prose-p`};function nt(e,t){return v(),u(`p`,tt,[y(e.$slots,`default`)])}var rt=/*#__PURE__*/ j(et,[[`render`,nt]]);const it={class:`prose-pre`},at={key:0,class:`prose-pre-filename`},ot={class:`prose-pre-actions`},st=[`title`],ct={key:0,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},lt={key:1,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},ut=/*@__PURE__*/ p({__name:`ProsePre`,props:{code:{type:String,default:``},language:{type:String,default:null},filename:{type:String,default:null},highlights:{type:Array,default:()=>[]},meta:{type:String,default:null},class:{type:String,default:null}},setup(e){let t=e,n=c(()=>t.filename?.includes(`:line-numbers`)),r=c(()=>t.filename?.replace(`:line-numbers`,``)||null),i=ne(!1);async function a(){t.code&&(await navigator.clipboard.writeText(t.code),i.value=!0,setTimeout(()=>i.value=!1,2e3))}return(e,t)=>(v(),u(`div`,it,[r.value?(v(),u(`div`,at,[d(`span`,null,re(r.value),1)])):l(``,!0),d(`div`,ot,[d(`button`,{type:`button`,class:`prose-pre-copy`,title:i.value?`Copied`:`Copy Code`,onClick:a},[i.value?(v(),u(`svg`,ct,[...t[0]||=[d(`path`,{d:`M20 6 9 17l-5-5`},null,-1)]])):(v(),u(`svg`,lt,[...t[1]||=[d(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),d(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},null,-1)]]))],8,st)]),d(`pre`,{class:_([e.$props.class,{"prose-pre-line-numbers":n.value}])},[y(e.$slots,`default`)],2)]))}}),dt={},ft={class:`prose-strong`};function pt(e,t){return v(),u(`strong`,ft,[y(e.$slots,`default`)])}var mt=/*#__PURE__*/ j(dt,[[`render`,pt]]);const ht={},gt={class:`prose-table-scroll`},_t={class:`prose-table`};function vt(e,t){return v(),u(`div`,gt,[d(`table`,_t,[y(e.$slots,`default`)])])}var yt=/*#__PURE__*/ j(ht,[[`render`,vt]]);const bt={},xt={class:`prose-tbody`};function St(e,t){return v(),u(`tbody`,xt,[y(e.$slots,`default`)])}var Ct=/*#__PURE__*/ j(bt,[[`render`,St]]);const wt={},Tt={class:`prose-td`};function Et(e,t){return v(),u(`td`,Tt,[y(e.$slots,`default`)])}var Dt=/*#__PURE__*/ j(wt,[[`render`,Et]]);const Ot={},kt={class:`prose-th`};function At(e,t){return v(),u(`th`,kt,[y(e.$slots,`default`)])}var jt=/*#__PURE__*/ j(Ot,[[`render`,At]]);const Mt={},Nt={class:`prose-thead`};function Pt(e,t){return v(),u(`thead`,Nt,[y(e.$slots,`default`)])}var Ft=/*#__PURE__*/ j(Mt,[[`render`,Pt]]);const It={},Lt={class:`prose-tr`};function Rt(e,t){return v(),u(`tr`,Lt,[y(e.$slots,`default`)])}var zt=/*#__PURE__*/ j(It,[[`render`,Rt]]);const Bt={},Vt={class:`prose-ul`};function Ht(e,t){return v(),u(`ul`,Vt,[y(e.$slots,`default`)])}var Ut=/*#__PURE__*/ j(Bt,[[`render`,Ht]]);const M=le,N=pe,P=_e,F=xe,I=we,L=De,R=Ae,z=Ne,B=Ie,V=ze,H=Ue,U=Ge,W=Ye,G=$e,K=rt,q=ut,J=mt,Y=yt,X=Ct,Z=Dt,Q=jt,Wt=Ft,Gt=zt,$=Ut,Kt={ProseA:M,ProseBlockquote:N,ProseCode:P,ProseEm:F,ProseH1:I,ProseH2:L,ProseH3:R,ProseH4:z,ProseH5:B,ProseH6:V,ProseHr:H,ProseImg:U,ProseLi:W,ProseOl:G,ProseP:K,ProsePre:q,ProseStrong:J,ProseTable:Y,ProseTbody:X,ProseTd:Z,ProseTh:Q,ProseThead:Wt,ProseTr:Gt,ProseUl:$};export{se as Markdown,k as MarkdownRenderer,M as ProseA,N as ProseBlockquote,P as ProseCode,F as ProseEm,I as ProseH1,L as ProseH2,R as ProseH3,z as ProseH4,B as ProseH5,V as ProseH6,H as ProseHr,U as ProseImg,W as ProseLi,G as ProseOl,K as ProseP,q as ProsePre,J as ProseStrong,Y as ProseTable,X as ProseTbody,Z as ProseTd,Q as ProseTh,Wt as ProseThead,Gt as ProseTr,$ as ProseUl,A as defineMarkdownComponent,oe as defineMarkdownRenderer,Kt as proseComponents};
|