@primeui-devkit/vue-markdown 0.1.0-rc.3 → 0.1.0-rc.5
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/dist/index.d.ts +424 -3
- package/dist/index.js +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,425 @@
|
|
|
1
|
-
|
|
2
|
-
import { DefineComponent } from 'vue';
|
|
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>;
|
|
3
423
|
|
|
4
424
|
declare const ProseA: DefineComponent<{
|
|
5
425
|
href?: string;
|
|
@@ -106,4 +526,5 @@ declare const proseComponents: {
|
|
|
106
526
|
ProseUl: DefineComponent<Record<string, never>>;
|
|
107
527
|
};
|
|
108
528
|
|
|
109
|
-
export { ProseA, ProseBlockquote, ProseCode, ProseEm, ProseH1, ProseH2, ProseH3, ProseH4, ProseH5, ProseH6, ProseHr, ProseImg, ProseLi, ProseOl, ProseP, ProsePre, ProseStrong, ProseTable, ProseTbody, ProseTd, ProseTh, ProseThead, ProseTr, ProseUl, proseComponents };
|
|
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 +1 @@
|
|
|
1
|
-
import{Comark as e,ComarkRenderer as t,defineComarkComponent as n,defineComarkRendererComponent as r}from"@comark/vue";import{computed as i,createCommentVNode as ee,createElementBlock as a,createElementVNode as o,defineComponent as s,normalizeClass as te,openBlock as c,ref as ne,renderSlot as l,toDisplayString as re}from"vue";const u=[`href`,`target`],ie=/*@__PURE__*/ s({__name:`ProseA`,props:{href:{type:String,default:``},target:{type:String,default:void 0,required:!1}},setup(e){let t=e;return(e,n)=>(c(),a(`a`,{class:`prose-a`,href:t.href,target:t.target},[l(e.$slots,`default`)],8,u))}});var d=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};const ae={},oe={class:`prose-blockquote`};function se(e,t){return c(),a(`blockquote`,oe,[l(e.$slots,`default`)])}var ce=/*#__PURE__*/ d(ae,[[`render`,se]]);const le={},ue={class:`prose-code`};function de(e,t){return c(),a(`code`,ue,[l(e.$slots,`default`)])}var fe=/*#__PURE__*/ d(le,[[`render`,de]]);const pe={},me={class:`prose-em`};function he(e,t){return c(),a(`em`,me,[l(e.$slots,`default`)])}var ge=/*#__PURE__*/ d(pe,[[`render`,he]]);const _e=[`id`],ve=[`href`],ye=/*@__PURE__*/ s({__name:`ProseH1`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h1`,{id:t.id,class:`prose-h1`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,ve)):l(e.$slots,`default`,{},void 0,void 0,1)],8,_e))}}),be=[`id`],xe=[`href`],Se=/*@__PURE__*/ s({__name:`ProseH2`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h2`,{id:t.id,class:`prose-h2`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,xe)):l(e.$slots,`default`,{},void 0,void 0,1)],8,be))}}),Ce=[`id`],we=[`href`],Te=/*@__PURE__*/ s({__name:`ProseH3`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h3`,{id:t.id,class:`prose-h3`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,we)):l(e.$slots,`default`,{},void 0,void 0,1)],8,Ce))}}),f=[`id`],p=[`href`],m=/*@__PURE__*/ s({__name:`ProseH4`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h4`,{id:t.id,class:`prose-h4`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,p)):l(e.$slots,`default`,{},void 0,void 0,1)],8,f))}}),h=[`id`],g=[`href`],_=/*@__PURE__*/ s({__name:`ProseH5`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h5`,{id:t.id,class:`prose-h5`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,g)):l(e.$slots,`default`,{},void 0,void 0,1)],8,h))}}),v=[`id`],y=[`href`],b=/*@__PURE__*/ s({__name:`ProseH6`,props:{id:{type:String,required:!1}},setup(e){let t=e,n=i(()=>!!t.id);return(e,r)=>(c(),a(`h6`,{id:t.id,class:`prose-h6`},[t.id&&n.value?(c(),a(`a`,{key:0,href:`#${t.id}`,class:`prose-heading-link`},[r[0]||=o(`span`,{class:`prose-heading-anchor`},`#`,-1),l(e.$slots,`default`)],8,y)):l(e.$slots,`default`,{},void 0,void 0,1)],8,v))}}),x={},S={class:`prose-hr`};function C(e,t){return c(),a(`hr`,S)}var w=/*#__PURE__*/ d(x,[[`render`,C]]);const T=[`src`,`alt`,`width`,`height`],E=/*@__PURE__*/ s({__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)=>(c(),a(`img`,{class:`prose-img`,src:t.src,alt:t.alt,width:t.width,height:t.height},null,8,T))}}),D={},O={class:`prose-li`};function Ee(e,t){return c(),a(`li`,O,[l(e.$slots,`default`)])}var De=/*#__PURE__*/ d(D,[[`render`,Ee]]);const Oe={},ke={class:`prose-ol`};function Ae(e,t){return c(),a(`ol`,ke,[l(e.$slots,`default`)])}var je=/*#__PURE__*/ d(Oe,[[`render`,Ae]]);const Me={},Ne={class:`prose-p`};function Pe(e,t){return c(),a(`p`,Ne,[l(e.$slots,`default`)])}var Fe=/*#__PURE__*/ d(Me,[[`render`,Pe]]);const Ie={class:`prose-pre`},Le={key:0,class:`prose-pre-filename`},Re={class:`prose-pre-actions`},ze=[`title`],Be={key:0,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},Ve={key:1,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},He=/*@__PURE__*/ s({__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=i(()=>t.filename?.includes(`:line-numbers`)),r=i(()=>t.filename?.replace(`:line-numbers`,``)||null),s=ne(!1);async function u(){t.code&&(await navigator.clipboard.writeText(t.code),s.value=!0,setTimeout(()=>s.value=!1,2e3))}return(e,t)=>(c(),a(`div`,Ie,[r.value?(c(),a(`div`,Le,[o(`span`,null,re(r.value),1)])):ee(``,!0),o(`div`,Re,[o(`button`,{type:`button`,class:`prose-pre-copy`,title:s.value?`Copied`:`Copy Code`,onClick:u},[s.value?(c(),a(`svg`,Be,[...t[0]||=[o(`path`,{d:`M20 6 9 17l-5-5`},null,-1)]])):(c(),a(`svg`,Ve,[...t[1]||=[o(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),o(`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,ze)]),o(`pre`,{class:te([e.$props.class,{"prose-pre-line-numbers":n.value}])},[l(e.$slots,`default`)],2)]))}}),k={},Ue={class:`prose-strong`};function We(e,t){return c(),a(`strong`,Ue,[l(e.$slots,`default`)])}var Ge=/*#__PURE__*/ d(k,[[`render`,We]]);const Ke={},qe={class:`prose-table-scroll`},Je={class:`prose-table`};function Ye(e,t){return c(),a(`div`,qe,[o(`table`,Je,[l(e.$slots,`default`)])])}var Xe=/*#__PURE__*/ d(Ke,[[`render`,Ye]]);const Ze={},Qe={class:`prose-tbody`};function $e(e,t){return c(),a(`tbody`,Qe,[l(e.$slots,`default`)])}var et=/*#__PURE__*/ d(Ze,[[`render`,$e]]);const tt={},nt={class:`prose-td`};function rt(e,t){return c(),a(`td`,nt,[l(e.$slots,`default`)])}var it=/*#__PURE__*/ d(tt,[[`render`,rt]]);const at={},ot={class:`prose-th`};function st(e,t){return c(),a(`th`,ot,[l(e.$slots,`default`)])}var ct=/*#__PURE__*/ d(at,[[`render`,st]]);const lt={},ut={class:`prose-thead`};function dt(e,t){return c(),a(`thead`,ut,[l(e.$slots,`default`)])}var ft=/*#__PURE__*/ d(lt,[[`render`,dt]]);const pt={},mt={class:`prose-tr`};function ht(e,t){return c(),a(`tr`,mt,[l(e.$slots,`default`)])}var gt=/*#__PURE__*/ d(pt,[[`render`,ht]]);const _t={},vt={class:`prose-ul`};function yt(e,t){return c(),a(`ul`,vt,[l(e.$slots,`default`)])}var bt=/*#__PURE__*/ d(_t,[[`render`,yt]]);const A=ie,j=ce,M=fe,N=ge,P=ye,F=Se,I=Te,L=m,R=_,z=b,B=w,V=E,H=De,U=je,W=Fe,G=He,K=Ge,q=Xe,J=et,Y=it,X=ct,Z=ft,Q=gt,$=bt,xt={ProseA:A,ProseBlockquote:j,ProseCode:M,ProseEm:N,ProseH1:P,ProseH2:F,ProseH3:I,ProseH4:L,ProseH5:R,ProseH6:z,ProseHr:B,ProseImg:V,ProseLi:H,ProseOl:U,ProseP:W,ProsePre:G,ProseStrong:K,ProseTable:q,ProseTbody:J,ProseTd:Y,ProseTh:X,ProseThead:Z,ProseTr:Q,ProseUl:$};export{e as Markdown,t as MarkdownRenderer,A as ProseA,j as ProseBlockquote,M as ProseCode,N as ProseEm,P as ProseH1,F as ProseH2,I as ProseH3,L as ProseH4,R as ProseH5,z as ProseH6,B as ProseHr,V as ProseImg,H as ProseLi,U as ProseOl,W as ProseP,G as ProsePre,K as ProseStrong,q as ProseTable,J as ProseTbody,Y as ProseTd,X as ProseTh,Z as ProseThead,Q as ProseTr,$ as ProseUl,n as defineMarkdownComponent,r as defineMarkdownRenderer,xt as proseComponents};
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primeui-devkit/vue-markdown",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
4
|
"author": "PrimeTek Informatics",
|
|
5
5
|
"description": "Vue renderer for the PrimeUI DevKit markdown AST, plus the Prose* component set. The rendering backend is an internal implementation detail.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -35,22 +35,23 @@
|
|
|
35
35
|
"README.md"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
38
|
+
"@primeui-devkit/markdown-core": "0.1.0-rc.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"vue": "^3.5.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"cross-env": "^10.1.0",
|
|
45
|
+
"jsdom": "^30.0.1",
|
|
45
46
|
"typescript": "~6.0.0",
|
|
47
|
+
"unplugin-vue": "^8.0.0",
|
|
46
48
|
"vitest": "4.1.11",
|
|
47
49
|
"vue": "^3.5.0",
|
|
48
50
|
"vue-tsc": "^3.3.9",
|
|
49
|
-
"@primeui-devkit/test-config": "0.1.0-rc.
|
|
50
|
-
"@primeui-devkit/
|
|
51
|
-
"@primeui-devkit/
|
|
52
|
-
"@primeui-devkit/ts-config": "0.1.0-rc.
|
|
53
|
-
"@primeui-devkit/bundle": "0.1.0-rc.1"
|
|
51
|
+
"@primeui-devkit/test-config": "0.1.0-rc.2",
|
|
52
|
+
"@primeui-devkit/bundle": "0.1.0-rc.2",
|
|
53
|
+
"@primeui-devkit/cli": "0.1.0-rc.2",
|
|
54
|
+
"@primeui-devkit/ts-config": "0.1.0-rc.2"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=22.18.0"
|