@cocoar/vue-markdown 1.6.4 → 1.6.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.css +2 -1
- package/dist/index.js +208 -292
- package/package.json +4 -4
package/dist/index.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
.coar-markdown{
|
|
1
|
+
.coar-markdown{--coar-markdown-text:var(--coar-text-neutral-primary);--coar-markdown-link:var(--coar-text-brand-primary,var(--coar-text-neutral-primary));--coar-markdown-muted-text:var(--coar-text-neutral-tertiary);--coar-markdown-border:var(--coar-border-neutral-tertiary);--coar-markdown-surface:var(--coar-background-neutral-primary);--coar-markdown-surface-muted:var(--coar-background-neutral-tertiary,var(--coar-background-neutral-primary));--coar-markdown-radius:var(--coar-radius-xs);--coar-markdown-space-1:var(--coar-spacing-s,.5rem);--coar-markdown-space-2:var(--coar-spacing-m,1rem);--coar-markdown-heading-block-start:var(--coar-spacing-xxxl,4rem);color:var(--coar-markdown-text);display:block}.coar-markdown :where(h1,h2,h3,h4,h5,h6){font-family:var(--coar-font-family-title,inherit);color:var(--coar-markdown-text)}.coar-markdown h1{font-size:var(--coar-font-size-xl);font-weight:var(--coar-font-weight-bold);line-height:var(--coar-line-height-tight)}.coar-markdown h2{font-size:var(--coar-font-size-l);font-weight:var(--coar-font-weight-bold);line-height:1.25}.coar-markdown h3{font-size:var(--coar-font-size-m);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-snug)}.coar-markdown h4{font-size:var(--coar-font-size-s);font-weight:var(--coar-font-weight-semi-bold);line-height:1.35}.coar-markdown h5{font-size:var(--coar-font-size-xs);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-normal)}.coar-markdown h6{font-size:var(--coar-font-size-xxs);font-weight:var(--coar-font-weight-medium);line-height:1.45}.coar-markdown-heading,.coar-markdown-paragraph,.coar-markdown-blockquote,.coar-markdown-list,.coar-markdown-code-block,.coar-markdown-table,.coar-markdown-hr{margin:0}.coar-markdown>:where(h1,h2,h3,h4,h5,h6,p,blockquote,ul,ol,pre,table,hr,.coar-code-block-host,.coar-table-host){margin-block:0 var(--coar-markdown-space-2)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-heading-block-start)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6)+:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-space-1)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6):first-child{margin-block-start:0}.coar-markdown-blockquote{padding-inline:var(--coar-markdown-space-2);border-left:2px solid var(--coar-markdown-border)}.coar-markdown-list{padding-inline-start:var(--coar-spacing-l,1.5rem);list-style-position:outside}.coar-markdown-list--unordered{list-style-type:disc}.coar-markdown-list--ordered{list-style-type:decimal}.coar-markdown-list-item{margin-block:.25em;display:list-item}.coar-markdown-list-item--task{align-items:flex-start;gap:var(--coar-spacing-s,.5rem);list-style:none;display:flex}.coar-markdown-list-item-content{min-width:0}.coar-markdown-task-checkbox{margin-top:.15em}.coar-markdown-code-block,.coar-markdown-code{display:block}.coar-markdown-inline-code{color:var(--coar-text-accent-secondary,var(--coar-markdown-link));background:0 0;border:0;border-radius:0;padding:0}.coar-markdown-link{color:var(--coar-markdown-link);text-decoration:underline}.coar-markdown-image{vertical-align:middle;max-width:100%;height:auto}.coar-markdown-table{border:1px solid var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);border-collapse:separate;border-spacing:0;width:100%;overflow:hidden}.coar-markdown-table-cell{padding:var(--coar-markdown-space-1);vertical-align:top;border-right:1px solid var(--coar-markdown-border);border-bottom:1px solid var(--coar-markdown-border)}.coar-markdown-table :where(tr) .coar-markdown-table-cell:last-child{border-right:0}.coar-markdown-table :where(tbody) tr:last-child .coar-markdown-table-cell{border-bottom:0}.coar-markdown-table :where(thead) .coar-markdown-table-cell{background:var(--coar-markdown-surface-muted);font-weight:600}.coar-markdown-hr{border:0;border-top:1px solid var(--coar-markdown-border)}.coar-markdown-unsupported,.coar-markdown-unsupported-inline{color:var(--coar-markdown-muted-text);font-style:italic}.coar-markdown-unsupported{padding:var(--coar-markdown-space-1);border:1px dashed var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);background:var(--coar-markdown-surface)}
|
|
2
|
+
/*$vite$:1*/
|
package/dist/index.js
CHANGED
|
@@ -1,293 +1,209 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CoarCodeBlock as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
type: "checkbox",
|
|
208
|
-
checked: s(z)(t),
|
|
209
|
-
disabled: "",
|
|
210
|
-
"aria-hidden": "true",
|
|
211
|
-
tabindex: "-1"
|
|
212
|
-
}, null, 8, lt)) : _("", !0),
|
|
213
|
-
m("div", st, [
|
|
214
|
-
i(o, {
|
|
215
|
-
nodes: t.children ?? []
|
|
216
|
-
}, null, 8, ["nodes"])
|
|
217
|
-
])
|
|
218
|
-
], 2)) : t.type === "codeBlock" ? (n(), p(s(S), {
|
|
219
|
-
key: 5,
|
|
220
|
-
class: "coar-markdown-code-block",
|
|
221
|
-
code: t.text ?? "",
|
|
222
|
-
language: s(E)(t),
|
|
223
|
-
collapsible: !1,
|
|
224
|
-
"show-copy": !0
|
|
225
|
-
}, null, 8, ["code", "language"])) : t.type === "thematicBreak" ? (n(), l("hr", ot)) : t.type === "table" ? (n(), p(s(V), {
|
|
226
|
-
key: 7,
|
|
227
|
-
variant: "plain",
|
|
228
|
-
hover: ""
|
|
229
|
-
}, {
|
|
230
|
-
default: C(() => [
|
|
231
|
-
(t.children ?? []).length > 0 ? (n(), l(a, { key: 0 }, [
|
|
232
|
-
m("thead", null, [
|
|
233
|
-
m("tr", null, [
|
|
234
|
-
(n(!0), l(a, null, k((t.children ?? [])[0]?.children ?? [], (u, d) => (n(), l("th", {
|
|
235
|
-
key: u.id,
|
|
236
|
-
class: y({
|
|
237
|
-
"text-right": s(B)(t, d),
|
|
238
|
-
"text-center": s(N)(t, d)
|
|
239
|
-
})
|
|
240
|
-
}, [
|
|
241
|
-
i(h, {
|
|
242
|
-
nodes: u.children ?? []
|
|
243
|
-
}, null, 8, ["nodes"])
|
|
244
|
-
], 2))), 128))
|
|
245
|
-
])
|
|
246
|
-
]),
|
|
247
|
-
m("tbody", null, [
|
|
248
|
-
(n(!0), l(a, null, k((t.children ?? []).slice(1), (u) => (n(), l("tr", {
|
|
249
|
-
key: u.id
|
|
250
|
-
}, [
|
|
251
|
-
(n(!0), l(a, null, k(u.children ?? [], (d, b) => (n(), l("td", {
|
|
252
|
-
key: d.id,
|
|
253
|
-
class: y({
|
|
254
|
-
"text-right": s(B)(t, b),
|
|
255
|
-
"text-center": s(N)(t, b)
|
|
256
|
-
})
|
|
257
|
-
}, [
|
|
258
|
-
i(h, {
|
|
259
|
-
nodes: d.children ?? []
|
|
260
|
-
}, null, 8, ["nodes"])
|
|
261
|
-
], 2))), 128))
|
|
262
|
-
]))), 128))
|
|
263
|
-
])
|
|
264
|
-
], 64)) : _("", !0)
|
|
265
|
-
]),
|
|
266
|
-
_: 2
|
|
267
|
-
}, 1024)) : t.type === "tableRow" ? (n(), p(o, {
|
|
268
|
-
key: 8,
|
|
269
|
-
nodes: t.children ?? []
|
|
270
|
-
}, null, 8, ["nodes"])) : t.type === "tableCell" ? (n(), l("td", it, [
|
|
271
|
-
i(h, {
|
|
272
|
-
nodes: t.children ?? []
|
|
273
|
-
}, null, 8, ["nodes"])
|
|
274
|
-
])) : (n(), l("div", at, " Unsupported markdown node: " + f(s(j)(t)), 1))
|
|
275
|
-
], 64))), 128);
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
}), ut = { class: "coar-markdown" }, kt = /* @__PURE__ */ g({
|
|
279
|
-
__name: "CoarMarkdown",
|
|
280
|
-
props: {
|
|
281
|
-
doc: {}
|
|
282
|
-
},
|
|
283
|
-
setup(r) {
|
|
284
|
-
return (e, c) => (n(), l("div", ut, [
|
|
285
|
-
i(ct, {
|
|
286
|
-
nodes: r.doc.nodes
|
|
287
|
-
}, null, 8, ["nodes"])
|
|
288
|
-
]));
|
|
289
|
-
}
|
|
1
|
+
import { Fragment as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderList as u, resolveComponent as d, resolveDynamicComponent as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
|
|
2
|
+
import { CoarCodeBlock as g, CoarTable as _ } from "@cocoar/vue-ui";
|
|
3
|
+
//#region src/helpers.ts
|
|
4
|
+
function v(e) {
|
|
5
|
+
let t = e.attrs?.depth;
|
|
6
|
+
if (typeof t != "number") return 1;
|
|
7
|
+
let n = Math.trunc(t);
|
|
8
|
+
return n <= 1 ? 1 : n === 2 ? 2 : n === 3 ? 3 : n === 4 ? 4 : n === 5 ? 5 : 6;
|
|
9
|
+
}
|
|
10
|
+
function y(e) {
|
|
11
|
+
let t = e.attrs?.anchor;
|
|
12
|
+
return typeof t == "string" && t.length > 0 ? t : null;
|
|
13
|
+
}
|
|
14
|
+
function b(e) {
|
|
15
|
+
let t = e.attrs?.language;
|
|
16
|
+
return typeof t == "string" && t.trim().length > 0 ? t.trim() : "text";
|
|
17
|
+
}
|
|
18
|
+
function x(e) {
|
|
19
|
+
return !!e.attrs?.ordered;
|
|
20
|
+
}
|
|
21
|
+
function S(e) {
|
|
22
|
+
let t = e.attrs?.start;
|
|
23
|
+
return typeof t == "number" ? t : null;
|
|
24
|
+
}
|
|
25
|
+
function C(e) {
|
|
26
|
+
return typeof e.attrs?.checked == "boolean";
|
|
27
|
+
}
|
|
28
|
+
function w(e) {
|
|
29
|
+
return e.attrs?.checked === !0;
|
|
30
|
+
}
|
|
31
|
+
function T(e) {
|
|
32
|
+
let t = e.attrs?.url;
|
|
33
|
+
return typeof t == "string" && t.length > 0 ? t : null;
|
|
34
|
+
}
|
|
35
|
+
function E(e) {
|
|
36
|
+
let t = T(e);
|
|
37
|
+
return t ? t.startsWith("#") && typeof window < "u" ? `${window.location.pathname}${window.location.search}${t}` : t : null;
|
|
38
|
+
}
|
|
39
|
+
function D(e) {
|
|
40
|
+
let t = T(e);
|
|
41
|
+
return t && I(t) ? "_blank" : null;
|
|
42
|
+
}
|
|
43
|
+
function O(e) {
|
|
44
|
+
let t = T(e);
|
|
45
|
+
return t && I(t) ? "noopener noreferrer" : null;
|
|
46
|
+
}
|
|
47
|
+
function k(e) {
|
|
48
|
+
let t = e.attrs?.url;
|
|
49
|
+
return typeof t == "string" && t.trim().length > 0 ? t.trim() : null;
|
|
50
|
+
}
|
|
51
|
+
function A(e) {
|
|
52
|
+
let t = e.attrs?.alt;
|
|
53
|
+
return typeof t == "string" ? t : "";
|
|
54
|
+
}
|
|
55
|
+
function j(e) {
|
|
56
|
+
let t = e.attrs?.title;
|
|
57
|
+
return typeof t == "string" && t.trim().length > 0 ? t.trim() : null;
|
|
58
|
+
}
|
|
59
|
+
function M(e, t) {
|
|
60
|
+
return F(e, t) === "right";
|
|
61
|
+
}
|
|
62
|
+
function N(e, t) {
|
|
63
|
+
return F(e, t) === "center";
|
|
64
|
+
}
|
|
65
|
+
function P(e) {
|
|
66
|
+
let t = e.attrs?.originalType;
|
|
67
|
+
return typeof t == "string" ? t : String(e.type);
|
|
68
|
+
}
|
|
69
|
+
function F(e, t) {
|
|
70
|
+
let n = e.attrs?.align;
|
|
71
|
+
if (!Array.isArray(n)) return null;
|
|
72
|
+
let r = n[t];
|
|
73
|
+
return r === "left" || r === "right" || r === "center" ? r : null;
|
|
74
|
+
}
|
|
75
|
+
function I(e) {
|
|
76
|
+
let t = e.trim();
|
|
77
|
+
return t.startsWith("#") || t.startsWith("/") || t.startsWith("./") || t.startsWith("../") || t.startsWith("mailto:") || t.startsWith("tel:") ? !1 : t.startsWith("http://") || t.startsWith("https://");
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/MarkdownInlineNode.vue?vue&type=script&setup=true&lang.ts
|
|
81
|
+
var L = { key: 1 }, R = { key: 2 }, z = { key: 3 }, B = {
|
|
82
|
+
key: 4,
|
|
83
|
+
class: "coar-markdown-inline-code"
|
|
84
|
+
}, V = { key: 5 }, H = [
|
|
85
|
+
"href",
|
|
86
|
+
"target",
|
|
87
|
+
"rel"
|
|
88
|
+
], U = [
|
|
89
|
+
"src",
|
|
90
|
+
"alt",
|
|
91
|
+
"title"
|
|
92
|
+
], W = {
|
|
93
|
+
key: 8,
|
|
94
|
+
class: "coar-markdown-unsupported-inline"
|
|
95
|
+
}, G = /* @__PURE__ */ s({
|
|
96
|
+
__name: "MarkdownInlineNode",
|
|
97
|
+
props: { nodes: {} },
|
|
98
|
+
setup(i) {
|
|
99
|
+
return (s, c) => {
|
|
100
|
+
let f = d("MarkdownInlineNode", !0);
|
|
101
|
+
return l(!0), r(e, null, u(i.nodes, (i) => (l(), r(e, { key: i.id }, [i.type === "text" ? (l(), r(e, { key: 0 }, [a(p(i.text ?? ""), 1)], 64)) : i.type === "emphasis" ? (l(), r("em", L, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "strong" ? (l(), r("strong", R, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "strikethrough" ? (l(), r("del", z, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "inlineCode" ? (l(), r("code", B, p(i.text ?? ""), 1)) : i.type === "lineBreak" ? (l(), r("br", V)) : i.type === "link" ? (l(), r(e, { key: 6 }, [m(E)(i) ? (l(), r("a", {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: "coar-markdown-link",
|
|
104
|
+
href: m(E)(i),
|
|
105
|
+
target: m(D)(i) ?? void 0,
|
|
106
|
+
rel: m(O)(i) ?? void 0
|
|
107
|
+
}, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])], 8, H)) : (l(), t(f, {
|
|
108
|
+
key: 1,
|
|
109
|
+
nodes: i.children ?? []
|
|
110
|
+
}, null, 8, ["nodes"]))], 64)) : i.type === "image" ? (l(), r(e, { key: 7 }, [m(k)(i) ? (l(), r("img", {
|
|
111
|
+
key: 0,
|
|
112
|
+
class: "coar-markdown-image",
|
|
113
|
+
src: m(k)(i),
|
|
114
|
+
alt: m(A)(i),
|
|
115
|
+
title: m(j)(i) ?? void 0,
|
|
116
|
+
loading: "lazy"
|
|
117
|
+
}, null, 8, U)) : n("", !0)], 64)) : (l(), r("span", W, "[unsupported]"))], 64))), 128);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}), K = {
|
|
121
|
+
key: 1,
|
|
122
|
+
class: "coar-markdown-paragraph"
|
|
123
|
+
}, q = {
|
|
124
|
+
key: 2,
|
|
125
|
+
class: "coar-markdown-blockquote"
|
|
126
|
+
}, J = ["start"], Y = {
|
|
127
|
+
key: 1,
|
|
128
|
+
class: "coar-markdown-list coar-markdown-list--unordered"
|
|
129
|
+
}, X = ["checked"], Z = { class: "coar-markdown-list-item-content" }, Q = {
|
|
130
|
+
key: 6,
|
|
131
|
+
class: "coar-markdown-hr"
|
|
132
|
+
}, $ = {
|
|
133
|
+
key: 9,
|
|
134
|
+
class: "coar-markdown-table-cell"
|
|
135
|
+
}, ee = {
|
|
136
|
+
key: 10,
|
|
137
|
+
class: "coar-markdown-unsupported"
|
|
138
|
+
}, te = /* @__PURE__ */ s({
|
|
139
|
+
__name: "MarkdownBlockNode",
|
|
140
|
+
props: {
|
|
141
|
+
nodes: {},
|
|
142
|
+
tableNode: {}
|
|
143
|
+
},
|
|
144
|
+
setup(a) {
|
|
145
|
+
return (s, T) => {
|
|
146
|
+
let E = d("MarkdownBlockNode", !0);
|
|
147
|
+
return l(!0), r(e, null, u(a.nodes, (a) => (l(), r(e, { key: a.id }, [a.type === "heading" ? (l(), t(f("h" + m(v)(a)), {
|
|
148
|
+
key: 0,
|
|
149
|
+
id: m(y)(a) ?? void 0,
|
|
150
|
+
class: "coar-markdown-heading"
|
|
151
|
+
}, {
|
|
152
|
+
default: h(() => [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])]),
|
|
153
|
+
_: 2
|
|
154
|
+
}, 1032, ["id"])) : a.type === "paragraph" ? (l(), r("p", K, [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : a.type === "blockquote" ? (l(), r("blockquote", q, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : a.type === "list" ? (l(), r(e, { key: 3 }, [m(x)(a) ? (l(), r("ol", {
|
|
155
|
+
key: 0,
|
|
156
|
+
class: "coar-markdown-list coar-markdown-list--ordered",
|
|
157
|
+
start: m(S)(a) ?? void 0
|
|
158
|
+
}, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])], 8, J)) : (l(), r("ul", Y, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])]))], 64)) : a.type === "listItem" ? (l(), r("li", {
|
|
159
|
+
key: 4,
|
|
160
|
+
class: c(["coar-markdown-list-item", { "coar-markdown-list-item--task": m(C)(a) }])
|
|
161
|
+
}, [m(C)(a) ? (l(), r("input", {
|
|
162
|
+
key: 0,
|
|
163
|
+
class: "coar-markdown-task-checkbox",
|
|
164
|
+
type: "checkbox",
|
|
165
|
+
checked: m(w)(a),
|
|
166
|
+
disabled: "",
|
|
167
|
+
"aria-hidden": "true",
|
|
168
|
+
tabindex: "-1"
|
|
169
|
+
}, null, 8, X)) : n("", !0), i("div", Z, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])])], 2)) : a.type === "codeBlock" ? (l(), t(m(g), {
|
|
170
|
+
key: 5,
|
|
171
|
+
class: "coar-markdown-code-block",
|
|
172
|
+
code: a.text ?? "",
|
|
173
|
+
language: m(b)(a),
|
|
174
|
+
collapsible: !1,
|
|
175
|
+
"show-copy": !0
|
|
176
|
+
}, null, 8, ["code", "language"])) : a.type === "thematicBreak" ? (l(), r("hr", Q)) : a.type === "table" ? (l(), t(m(_), {
|
|
177
|
+
key: 7,
|
|
178
|
+
variant: "plain",
|
|
179
|
+
hover: ""
|
|
180
|
+
}, {
|
|
181
|
+
default: h(() => [(a.children ?? []).length > 0 ? (l(), r(e, { key: 0 }, [i("thead", null, [i("tr", null, [(l(!0), r(e, null, u((a.children ?? [])[0]?.children ?? [], (e, t) => (l(), r("th", {
|
|
182
|
+
key: e.id,
|
|
183
|
+
class: c({
|
|
184
|
+
"text-right": m(M)(a, t),
|
|
185
|
+
"text-center": m(N)(a, t)
|
|
186
|
+
})
|
|
187
|
+
}, [o(G, { nodes: e.children ?? [] }, null, 8, ["nodes"])], 2))), 128))])]), i("tbody", null, [(l(!0), r(e, null, u((a.children ?? []).slice(1), (t) => (l(), r("tr", { key: t.id }, [(l(!0), r(e, null, u(t.children ?? [], (e, t) => (l(), r("td", {
|
|
188
|
+
key: e.id,
|
|
189
|
+
class: c({
|
|
190
|
+
"text-right": m(M)(a, t),
|
|
191
|
+
"text-center": m(N)(a, t)
|
|
192
|
+
})
|
|
193
|
+
}, [o(G, { nodes: e.children ?? [] }, null, 8, ["nodes"])], 2))), 128))]))), 128))])], 64)) : n("", !0)]),
|
|
194
|
+
_: 2
|
|
195
|
+
}, 1024)) : a.type === "tableRow" ? (l(), t(E, {
|
|
196
|
+
key: 8,
|
|
197
|
+
nodes: a.children ?? []
|
|
198
|
+
}, null, 8, ["nodes"])) : a.type === "tableCell" ? (l(), r("td", $, [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : (l(), r("div", ee, " Unsupported markdown node: " + p(m(P)(a)), 1))], 64))), 128);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}), ne = { class: "coar-markdown" }, re = /* @__PURE__ */ s({
|
|
202
|
+
__name: "CoarMarkdown",
|
|
203
|
+
props: { doc: {} },
|
|
204
|
+
setup(e) {
|
|
205
|
+
return (t, n) => (l(), r("div", ne, [o(te, { nodes: e.doc.nodes }, null, 8, ["nodes"])]));
|
|
206
|
+
}
|
|
290
207
|
});
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
};
|
|
208
|
+
//#endregion
|
|
209
|
+
export { re as CoarMarkdown };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-markdown",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "Markdown viewer component for Vue 3 with Cocoar Design System styling",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"lint": "eslint src/"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cocoar/vue-markdown-core": "1.6.
|
|
41
|
+
"@cocoar/vue-markdown-core": "1.6.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cocoar/vue-ui": "1.6.
|
|
44
|
+
"@cocoar/vue-ui": "1.6.5",
|
|
45
45
|
"vue": "^3.5.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@cocoar/vue-ui": "workspace:*",
|
|
49
|
-
"vue": "^3.5.
|
|
49
|
+
"vue": "^3.5.32"
|
|
50
50
|
}
|
|
51
51
|
}
|