@wenyan-md/core 1.0.4 → 1.0.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/core.js CHANGED
@@ -1,133 +1,142 @@
1
- import { marked as y } from "marked";
2
- import { markedHighlight as H } from "marked-highlight";
3
- import M from "highlight.js";
4
- import I from "front-matter";
1
+ import { marked as g } from "marked";
2
+ import { markedHighlight as L } from "marked-highlight";
3
+ import w from "highlight.js";
4
+ import T from "front-matter";
5
5
  import * as f from "css-tree";
6
- import { mathjax as j } from "mathjax-full/js/mathjax.js";
7
- import { TeX as q } from "mathjax-full/js/input/tex.js";
8
- import { SVG as R } from "mathjax-full/js/output/svg.js";
9
- import { liteAdaptor as N } from "mathjax-full/js/adaptors/liteAdaptor.js";
10
- import { RegisterHTMLHandler as z } from "mathjax-full/js/handlers/html.js";
11
- import { AllPackages as D } from "mathjax-full/js/input/tex/AllPackages.js";
12
- import { themes as S } from "./theme.js";
13
- import { hlThemes as A } from "./hltheme.js";
14
- const B = `#wenyan pre::before {
6
+ import { mathjax as P } from "mathjax-full/js/mathjax.js";
7
+ import { TeX as H } from "mathjax-full/js/input/tex.js";
8
+ import { SVG as V } from "mathjax-full/js/output/svg.js";
9
+ import { liteAdaptor as j } from "mathjax-full/js/adaptors/liteAdaptor.js";
10
+ import { RegisterHTMLHandler as q } from "mathjax-full/js/handlers/html.js";
11
+ import { AllPackages as E } from "mathjax-full/js/input/tex/AllPackages.js";
12
+ import { themes as v } from "./theme.js";
13
+ import { getAllThemes as ue, otherThemes as he } from "./theme.js";
14
+ import { hlThemes as C } from "./hltheme.js";
15
+ import { getAllHlThemes as ge } from "./hltheme.js";
16
+ const R = `#wenyan pre::before {
15
17
  display: block;
16
18
  content: "";
17
19
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="12" viewBox="0 0 450 130"><ellipse cx="65" cy="65" rx="50" ry="52" stroke="rgb(220,60,54)" stroke-width="2" fill="rgb(237,108,96)"/><ellipse cx="225" cy="65" rx="50" ry="52" stroke="rgb(218,151,33)" stroke-width="2" fill="rgb(247,193,81)"/><ellipse cx="385" cy="65" rx="50" ry="52" stroke="rgb(27,161,37)" stroke-width="2" fill="rgb(100,200,86)"/></svg>');
18
20
  background-repeat: no-repeat;
19
21
  width: 100%;
20
22
  height: 16px;
21
- }`, ce = "ui-serif, Georgia, Cambria, 'Noto Serif', 'Times New Roman', serif", F = "ui-sans-serif, system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', 'Roboto', sans-serif", T = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace", G = {
23
+ }`, ne = "ui-serif, Georgia, Cambria, 'Noto Serif', 'Times New Roman', serif", z = "ui-sans-serif, system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', 'Roboto', sans-serif", A = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace", I = {
22
24
  inlineMath: [["$", "$"], ["\\(", "\\)"]],
23
25
  displayMath: [["$$", "$$"], ["\\[", "\\]"]],
24
26
  processEscapes: !0,
25
- packages: D.sort().join(", ").split(/\s*,\s*/)
26
- }, J = {
27
+ packages: E
28
+ }, N = {
27
29
  fontCache: "none"
28
- }, $ = N();
29
- z($);
30
- const U = new q(G), W = new R(J);
31
- function E(r, n) {
32
- const s = r.display ? "section" : "span", e = r.display ? "block-equation" : "inline-equation";
33
- r.typesetRoot = n.adaptor.node(s, { class: e }, [r.typesetRoot]);
30
+ }, b = j();
31
+ q(b);
32
+ const D = new H(I), F = new V(N);
33
+ function $(o, s) {
34
+ const n = o.display ? "section" : "span", e = o.display ? "block-equation" : "inline-equation";
35
+ o.typesetRoot = s.adaptor.node(n, { class: e }, [o.typesetRoot]);
34
36
  }
35
- async function O(r) {
37
+ async function G(o) {
36
38
  try {
37
- const n = j.document(r, {
38
- InputJax: U,
39
- OutputJax: W,
39
+ const s = P.document(o, {
40
+ InputJax: D,
41
+ OutputJax: F,
40
42
  renderActions: {
41
- addContainer: [190, (s) => {
42
- for (const e of s.math)
43
- E(e, s);
44
- }, E]
43
+ addContainer: [190, (e) => {
44
+ for (const t of e.math)
45
+ $(t, e);
46
+ }, $]
45
47
  }
46
48
  });
47
- return n.render(), $.outerHTML($.root(n.document));
48
- } catch (n) {
49
- throw console.error("Error rendering MathJax:", n), n;
49
+ s.render();
50
+ const n = b.body(s.document);
51
+ return b.innerHTML(n);
52
+ } catch (s) {
53
+ throw console.error("Error rendering MathJax:", s), s;
50
54
  }
51
55
  }
52
- function pe() {
53
- y.use(
54
- H({
56
+ function ae() {
57
+ g.use(
58
+ L({
55
59
  langPrefix: "hljs language-",
56
60
  highlight: function(e, t) {
57
- return t = M.getLanguage(t) ? t : "plaintext", M.highlight(e, { language: t }).value;
61
+ return t = w.getLanguage(t) ? t : "plaintext", w.highlight(e, { language: t }).value;
58
62
  }
59
63
  })
60
64
  );
61
- const r = {
65
+ const o = {
62
66
  name: "attributeImage",
63
67
  level: "inline",
64
68
  start(e) {
65
69
  return e.indexOf("![");
66
70
  },
67
71
  tokenizer(e) {
68
- const o = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(e);
69
- if (o)
72
+ const i = /^!\[([^\]]*)\]\(([^)]+)\)\{(.*?)\}/.exec(e);
73
+ if (i)
70
74
  return {
71
75
  type: "attributeImage",
72
- raw: o[0],
73
- alt: o[1],
74
- href: o[2],
75
- attrs: o[3]
76
+ raw: i[0],
77
+ alt: i[1],
78
+ href: i[2],
79
+ attrs: i[3]
76
80
  };
77
81
  },
78
82
  renderer(e) {
79
- const t = Y(e.attrs), o = Array.from(t).map(
80
- ([i, a]) => /^\d+$/.test(a) ? `${i}:${a}px` : `${i}:${a}`
83
+ const t = B(e.attrs), i = Array.from(t).map(
84
+ ([l, r]) => /^\d+$/.test(r) ? `${l}:${r}px` : `${l}:${r}`
81
85
  ).join("; ");
82
- return `<img src="${e.href}" alt="${e.alt}" style="${o}">`;
86
+ return `<img src="${e.href}" alt="${e.alt}" style="${i}">`;
83
87
  }
84
88
  };
85
- y.use({ extensions: [r] });
86
- const n = y.Renderer, s = y.Parser;
87
- n.heading = function(e) {
88
- const t = s.parseInline(e.tokens), o = e.depth;
89
- return `<h${o}><span>${t}</span></h${o}>
89
+ g.use({ extensions: [o] });
90
+ const s = g.Renderer, n = g.Parser;
91
+ s.heading = function(e) {
92
+ const t = n.parseInline(e.tokens), i = e.depth;
93
+ return `<h${i}><span>${t}</span></h${i}>
90
94
  `;
91
- }, n.paragraph = function(e) {
95
+ }, s.paragraph = function(e) {
92
96
  const t = e.text;
93
97
  return t.length > 4 && (/\$\$[\s\S]*?\$\$/g.test(t) || /\\\[[\s\S]*?\\\]/g.test(t)) ? `${t}
94
- ` : `<p>${s.parseInline(e.tokens)}</p>
98
+ ` : `<p>${n.parseInline(e.tokens)}</p>
95
99
  `;
96
- }, n.image = function(e, t, o) {
97
- return `<img src="${e.href}" alt="${o || ""}" title="${t || o || ""}">`;
98
- }, y.use({ renderer: n });
100
+ }, s.image = function(e, t, i) {
101
+ return `<img src="${e.href}" alt="${i || ""}" title="${t || i || ""}">`;
102
+ }, g.use({ renderer: s });
99
103
  }
100
- function Y(r) {
101
- const n = /* @__PURE__ */ new Map();
102
- return r.split(/\s+/).forEach((s) => {
103
- const [e, t] = s.split("=");
104
- e && t && n.set(e, t.replace(/^["']|["']$/g, ""));
105
- }), n;
104
+ function B(o) {
105
+ const s = /* @__PURE__ */ new Map();
106
+ return o.split(/\s+/).forEach((n) => {
107
+ const [e, t] = n.split("=");
108
+ e && t && s.set(e, t.replace(/^["']|["']$/g, ""));
109
+ }), s;
106
110
  }
107
- function fe(r) {
108
- const { attributes: n, body: s } = I(r), e = {};
111
+ function ie(o) {
112
+ const { attributes: s, body: n } = T(o), e = {};
109
113
  let t = "";
110
- const { title: o, description: i, cover: a } = n;
111
- return o && (e.title = o), i && (t += "> " + i + `
114
+ const { title: i, description: l, cover: r } = s;
115
+ return i && (e.title = i), l && (t += "> " + l + `
112
116
 
113
- `, e.description = i), a && (e.cover = a), e.body = t + s, e;
117
+ `, e.description = l), r && (e.cover = r), e.body = t + n, e;
114
118
  }
115
- async function ue(r) {
116
- const n = y.parse(r);
117
- return await O(n);
119
+ async function le(o) {
120
+ const s = g.parse(o);
121
+ return await G(s);
118
122
  }
119
- async function he(r, n, s, e) {
120
- if (!(n in S))
123
+ async function ce(o, s, n, e) {
124
+ let t = v.default;
125
+ if (s && (t = v[s], t || (t = Object.values(v).find(
126
+ (a) => a.name.toLowerCase() === s.toLowerCase()
127
+ ))), !t)
121
128
  throw new Error("主题不存在");
122
- if (!(s in A))
129
+ if (!(n in C))
123
130
  throw new Error("代码块主题不存在");
124
- const t = S[n];
125
- let o = Z(await t.getCss());
126
- o = X(o, {
131
+ const i = O(await t.getCss()), r = await C[n].getCss();
132
+ return J(o, i, r, e);
133
+ }
134
+ async function J(o, s, n, e) {
135
+ s = U(s, {
127
136
  "#wenyan pre code": [
128
137
  {
129
138
  property: "font-family",
130
- value: T,
139
+ value: A,
131
140
  append: !0
132
141
  }
133
142
  ],
@@ -139,187 +148,179 @@ async function he(r, n, s, e) {
139
148
  }
140
149
  ]
141
150
  });
142
- const i = f.parse(o, {
151
+ const t = f.parse(s, {
143
152
  context: "stylesheet",
144
153
  positions: !1,
145
154
  parseAtrulePrelude: !1,
146
155
  parseCustomProperty: !1,
147
156
  parseValue: !1
148
- }), u = await A[s].getCss(), h = f.parse(u, {
157
+ }), i = f.parse(n, {
149
158
  context: "stylesheet",
150
159
  positions: !1,
151
160
  parseAtrulePrelude: !1,
152
161
  parseCustomProperty: !1,
153
162
  parseValue: !1
154
163
  });
155
- if (i.children.appendList(h.children), e) {
156
- const c = f.parse(B, {
164
+ if (t.children.appendList(i.children), e) {
165
+ const r = f.parse(R, {
157
166
  context: "stylesheet",
158
167
  positions: !1,
159
168
  parseAtrulePrelude: !1,
160
169
  parseCustomProperty: !1,
161
170
  parseValue: !1
162
171
  });
163
- i.children.appendList(c.children);
172
+ t.children.appendList(r.children);
164
173
  }
165
- const l = r.getElementById("wenyan");
166
- f.walk(i, {
174
+ f.walk(t, {
167
175
  visit: "Rule",
168
- enter(c, p, g) {
169
- const d = c.prelude.children;
170
- d && d.forEach((w) => {
171
- const v = f.generate(w), k = c.block.children.toArray();
172
- v === "#wenyan" ? k.forEach((x) => {
173
- const b = f.generate(x.value);
174
- l.style[x.property] = b;
175
- }) : l.querySelectorAll(v).forEach((b) => {
176
- k.forEach((C) => {
177
- const V = f.generate(C.value);
178
- b.style[C.property] = V;
176
+ enter(r, a, p) {
177
+ const c = r.prelude.children;
178
+ c && c.forEach((h) => {
179
+ const u = f.generate(h), m = r.block.children.toArray();
180
+ u === "#wenyan" ? m.forEach((d) => {
181
+ const y = f.generate(d.value);
182
+ o.style[d.property] = y;
183
+ }) : o.querySelectorAll(u).forEach((y) => {
184
+ m.forEach((x) => {
185
+ const S = f.generate(x.value);
186
+ y.style[x.property] = S;
179
187
  });
180
188
  });
181
189
  });
182
190
  }
183
191
  });
184
- let m = l.querySelectorAll("mjx-container");
185
- return m.forEach((c) => {
186
- const p = c.querySelector("svg");
187
- p.style.width = p.getAttribute("width"), p.style.height = p.getAttribute("height"), p.removeAttribute("width"), p.removeAttribute("height");
188
- const g = c.parentElement;
189
- c.remove(), g.appendChild(p), g.classList.contains("block-equation") && g.setAttribute(
190
- "style",
191
- "text-align: center; margin-bottom: 1rem;"
192
- );
193
- }), m = l.querySelectorAll("pre code"), m.forEach((c) => {
194
- c.innerHTML = c.innerHTML.replace(/\n/g, "<br>").replace(
195
- /(>[^<]+)|(^[^<]+)/g,
196
- (p) => p.replace(/\s/g, "&nbsp;")
197
- );
198
- }), m = l.querySelectorAll(
199
- "h1, h2, h3, h4, h5, h6, blockquote, pre"
200
- ), m.forEach((c) => {
201
- const p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
202
- f.walk(i, {
192
+ let l = o.querySelectorAll("mjx-container");
193
+ return l.forEach((r) => {
194
+ const a = r.querySelector("svg");
195
+ a.style.width = a.getAttribute("width"), a.style.height = a.getAttribute("height"), a.removeAttribute("width"), a.removeAttribute("height");
196
+ const p = r.parentElement;
197
+ r.remove(), p.appendChild(a), p.classList.contains("block-equation") && p.setAttribute("style", "text-align: center; margin-bottom: 1rem;");
198
+ }), l = o.querySelectorAll("pre code"), l.forEach((r) => {
199
+ r.innerHTML = r.innerHTML.replace(/\n/g, "<br>").replace(/(>[^<]+)|(^[^<]+)/g, (a) => a.replace(/\s/g, "&nbsp;"));
200
+ }), l = o.querySelectorAll("h1, h2, h3, h4, h5, h6, blockquote, pre"), l.forEach((r) => {
201
+ const a = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
202
+ f.walk(t, {
203
203
  visit: "Rule",
204
- enter(d) {
205
- const w = f.generate(d.prelude), v = c.tagName.toLowerCase();
206
- w.includes(`${v}::after`) ? L(d, p) : w.includes(`${v}::before`) && L(d, g);
204
+ enter(c) {
205
+ const h = f.generate(c.prelude), u = r.tagName.toLowerCase();
206
+ h.includes(`${u}::after`) ? k(c, a) : h.includes(`${u}::before`) && k(c, p);
207
207
  }
208
- }), p.size > 0 && c.appendChild(P(p, r)), g.size > 0 && c.insertBefore(
209
- P(g, r),
210
- c.firstChild
211
- );
212
- }), l.setAttribute("data-provider", "WenYan"), `${l.outerHTML.replace(
213
- /class="mjx-solid"/g,
214
- 'fill="none" stroke-width="70"'
215
- )}`;
208
+ }), a.size > 0 && r.appendChild(M(a, o.ownerDocument)), p.size > 0 && r.insertBefore(M(p, o.ownerDocument), r.firstChild);
209
+ }), o.setAttribute("data-provider", "WenYan"), `${o.outerHTML.replace(/class="mjx-solid"/g, 'fill="none" stroke-width="70"')}`;
216
210
  }
217
- function Z(r) {
218
- const n = /--([a-zA-Z0-9\-]+):\s*([^;()]*\((?:[^()]*|\([^()]*\))*\)[^;()]*|[^;]+);/g, s = /var\(--([a-zA-Z0-9\-]+)\)/g, e = {};
211
+ function O(o) {
212
+ const s = /--([a-zA-Z0-9\-]+):\s*([^;()]*\((?:[^()]*|\([^()]*\))*\)[^;()]*|[^;]+);/g, n = /var\(--([a-zA-Z0-9\-]+)\)/g, e = {};
219
213
  let t;
220
- for (; (t = n.exec(r)) !== null; ) {
221
- const a = t[1], u = t[2].trim().replaceAll(`
214
+ for (; (t = s.exec(o)) !== null; ) {
215
+ const r = t[1], a = t[2].trim().replaceAll(`
222
216
  `, "");
223
- e[a] = u;
217
+ e[r] = a;
224
218
  }
225
- e["sans-serif-font"] || (e["sans-serif-font"] = F), e["monospace-font"] || (e["monospace-font"] = T);
226
- function o(a, u, h = /* @__PURE__ */ new Set()) {
227
- if (h.has(a)) return a;
228
- h.add(a);
229
- let l = a, m;
230
- for (; (m = s.exec(l)) !== null; ) {
231
- const c = m[1];
232
- if (u[c]) {
233
- const p = o(u[c], u, h);
234
- l = l.replace(m[0], p);
219
+ e["sans-serif-font"] || (e["sans-serif-font"] = z), e["monospace-font"] || (e["monospace-font"] = A);
220
+ function i(r, a, p = /* @__PURE__ */ new Set()) {
221
+ if (p.has(r)) return r;
222
+ p.add(r);
223
+ let c = r, h;
224
+ for (; (h = n.exec(c)) !== null; ) {
225
+ const u = h[1];
226
+ if (a[u]) {
227
+ const m = i(a[u], a, p);
228
+ c = c.replace(h[0], m);
235
229
  }
236
230
  }
237
- return l;
231
+ return c;
238
232
  }
239
- for (const a in e) {
240
- const u = o(e[a], e);
241
- e[a] = u;
233
+ for (const r in e) {
234
+ const a = i(e[r], e);
235
+ e[r] = a;
242
236
  }
243
- let i = r;
244
- for (; (t = s.exec(r)) !== null; ) {
245
- const a = t[1];
246
- e[a] && (i = i.replace(t[0], e[a]));
237
+ let l = o;
238
+ for (; (t = n.exec(o)) !== null; ) {
239
+ const r = t[1];
240
+ e[r] && (l = l.replace(t[0], e[r]));
247
241
  }
248
- return i.replace(/:root\s*\{[^}]*\}/g, "");
242
+ return l.replace(/:root\s*\{[^}]*\}/g, "");
249
243
  }
250
- function X(r, n) {
251
- const s = f.parse(r, {
244
+ function U(o, s) {
245
+ const n = f.parse(o, {
252
246
  context: "stylesheet",
253
247
  positions: !1,
254
248
  parseAtrulePrelude: !1,
255
249
  parseCustomProperty: !1,
256
250
  parseValue: !1
257
251
  });
258
- return f.walk(s, {
252
+ return f.walk(n, {
259
253
  visit: "Rule",
260
- leave: (e, t, o) => {
254
+ leave: (e, t, i) => {
261
255
  if (e.prelude.type !== "SelectorList") return;
262
- const i = e.prelude.children.toArray().map((a) => f.generate(a));
263
- if (i) {
264
- const a = i[0], u = n[a];
265
- if (!u) return;
266
- for (const { property: h, value: l, append: m } of u)
267
- if (l) {
268
- let c = !1;
269
- f.walk(e.block, (p) => {
270
- p.type === "Declaration" && p.property === h && (p.value = f.parse(l, { context: "value" }), c = !0);
271
- }), !c && m && e.block.children.prepend(
272
- o.createItem({
256
+ const l = e.prelude.children.toArray().map((r) => f.generate(r));
257
+ if (l) {
258
+ const r = l[0], a = s[r];
259
+ if (!a) return;
260
+ for (const { property: p, value: c, append: h } of a)
261
+ if (c) {
262
+ let u = !1;
263
+ f.walk(e.block, (m) => {
264
+ m.type === "Declaration" && m.property === p && (m.value = f.parse(c, { context: "value" }), u = !0);
265
+ }), !u && h && e.block.children.prepend(
266
+ i.createItem({
273
267
  type: "Declaration",
274
- property: h,
275
- value: f.parse(l, { context: "value" })
268
+ property: p,
269
+ value: f.parse(c, { context: "value" })
276
270
  })
277
271
  );
278
272
  }
279
273
  }
280
274
  }
281
- }), f.generate(s);
275
+ }), f.generate(n);
282
276
  }
283
- function L(r, n) {
284
- f.walk(r.block, {
277
+ function k(o, s) {
278
+ f.walk(o.block, {
285
279
  visit: "Declaration",
286
- enter(s) {
287
- const e = s.property, t = f.generate(s.value);
288
- n.set(e, t);
280
+ enter(n) {
281
+ const e = n.property, t = f.generate(n.value);
282
+ s.set(e, t);
289
283
  }
290
284
  });
291
285
  }
292
- function P(r, n) {
293
- const s = n.createElement("section");
294
- r.get("content") && (s.textContent = r.get("content").replace(/['"]/g, ""), r.delete("content"));
295
- for (const [o, i] of r)
296
- if (i.includes("url(")) {
297
- const a = i.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/), u = i.match(/data:image\/svg\+xml;base64,([^"'\)]*)["']?\)/), h = i.match(/(?:"|')?(https?[^"'\)]*)(?:"|')?\)/);
298
- if (a) {
299
- const l = decodeURIComponent(a[1]);
300
- s.innerHTML = l;
301
- } else if (u) {
302
- const l = atob(u[1]);
303
- s.innerHTML = l;
304
- } else if (h) {
305
- const l = n.createElement("img");
306
- l.src = h[1], l.setAttribute("style", "vertical-align: top;"), s.appendChild(l);
286
+ function M(o, s) {
287
+ const n = s.createElement("section");
288
+ o.get("content") && (n.textContent = o.get("content").replace(/['"]/g, ""), o.delete("content"));
289
+ for (const [i, l] of o)
290
+ if (l.includes("url(")) {
291
+ const r = l.match(/data:image\/svg\+xml;utf8,(.*<\/svg>)/), a = l.match(/data:image\/svg\+xml;base64,([^"'\)]*)["']?\)/), p = l.match(/(?:"|')?(https?[^"'\)]*)(?:"|')?\)/);
292
+ if (r) {
293
+ const c = decodeURIComponent(r[1]);
294
+ n.innerHTML = c;
295
+ } else if (a) {
296
+ const c = atob(a[1]);
297
+ n.innerHTML = c;
298
+ } else if (p) {
299
+ const c = s.createElement("img");
300
+ c.src = p[1], c.setAttribute("style", "vertical-align: top;"), n.appendChild(c);
307
301
  }
308
- r.delete(o);
302
+ o.delete(i);
309
303
  }
310
- const t = Array.from(r.entries()).map(([o, i]) => `${o}: ${i}`).join("; ");
311
- return s.style.cssText = t, s;
304
+ const t = Array.from(o.entries()).map(([i, l]) => `${i}: ${l}`).join("; ");
305
+ return n.style.cssText = t, n;
312
306
  }
313
307
  export {
314
- P as buildPseudoSpan,
315
- pe as configureMarked,
316
- L as extractDeclarations,
317
- he as getContentForGzh,
318
- fe as handleFrontMatter,
319
- X as modifyCss,
320
- T as monospace,
321
- ue as renderMarkdown,
322
- Z as replaceCSSVariables,
323
- F as sansSerif,
324
- ce as serif
308
+ M as buildPseudoSpan,
309
+ ae as configureMarked,
310
+ k as extractDeclarations,
311
+ ge as getAllHlThemes,
312
+ ue as getAllThemes,
313
+ ce as getContentForGzhBuiltinTheme,
314
+ J as getContentForGzhCustomCss,
315
+ ie as handleFrontMatter,
316
+ C as hlThemes,
317
+ R as macStyleCss,
318
+ U as modifyCss,
319
+ A as monospace,
320
+ he as otherThemes,
321
+ le as renderMarkdown,
322
+ O as replaceCSSVariables,
323
+ z as sansSerif,
324
+ ne as serif,
325
+ v as themes
325
326
  };
@@ -0,0 +1,139 @@
1
+ const n = `:root {
2
+ --sans-serif-font: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
3
+ "Noto Color Emoji";
4
+ --monospace-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "liberation mono", "courier new", monospace;
5
+ }
6
+ #wenyan {
7
+ font-family: var(--sans-serif-font);
8
+ line-height: 1.75;
9
+ }
10
+ #wenyan * {
11
+ box-sizing: border-box;
12
+ }
13
+ #wenyan h1,
14
+ #wenyan h2,
15
+ #wenyan h3,
16
+ #wenyan h4,
17
+ #wenyan h5,
18
+ #wenyan h6,
19
+ #wenyan p,
20
+ #wenyan pre {
21
+ margin: 1em 0;
22
+ }
23
+ #wenyan h1,
24
+ #wenyan h2,
25
+ #wenyan h3,
26
+ #wenyan h4,
27
+ #wenyan h5,
28
+ #wenyan h6 {
29
+ line-height: 1.5;
30
+ margin-top: 35px;
31
+ margin-bottom: 10px;
32
+ padding-bottom: 5px;
33
+ }
34
+ #wenyan h1 {
35
+ font-size: 24px;
36
+ line-height: 38px;
37
+ margin-bottom: 5px;
38
+ }
39
+ #wenyan h2 {
40
+ font-size: 22px;
41
+ line-height: 34px;
42
+ padding-bottom: 12px;
43
+ border-bottom: 1px solid #ececec;
44
+ }
45
+ #wenyan h3 {
46
+ font-size: 20px;
47
+ line-height: 28px;
48
+ }
49
+ #wenyan ul,
50
+ #wenyan ol {
51
+ padding-left: 1.2em;
52
+ }
53
+ #wenyan li {
54
+ margin-left: 1.2em;
55
+ }
56
+ #wenyan img {
57
+ max-width: 100%;
58
+ height: auto;
59
+ margin: 0 auto;
60
+ display: block;
61
+ }
62
+ #wenyan table {
63
+ display: inline-block !important;
64
+ font-size: 12px;
65
+ width: auto;
66
+ max-width: 100%;
67
+ overflow: auto;
68
+ border: 1px solid #f6f6f6;
69
+ }
70
+ #wenyan thead {
71
+ background: #f6f6f6;
72
+ color: #000;
73
+ text-align: left;
74
+ }
75
+ #wenyan table td,
76
+ #wenyan table th {
77
+ padding: 12px 7px;
78
+ line-height: 24px;
79
+ }
80
+ #wenyan blockquote {
81
+ color: #666;
82
+ padding: 1px 23px;
83
+ margin: 22px 0;
84
+ border-left: 4px solid #cbcbcb;
85
+ background-color: #f8f8f8;
86
+ font-size: 0.95em;
87
+ }
88
+ #wenyan p code {
89
+ font-family: var(--monospace-font);
90
+ background: #fff5f5;
91
+ color: #ff502c;
92
+ padding: 4px 6px;
93
+ font-size: 0.78em;
94
+ }
95
+ #wenyan pre {
96
+ line-height: 2;
97
+ margin: 1em 0.5em;
98
+ padding: .5em;
99
+ color: #333;
100
+ background: #f8f8f8;
101
+ }
102
+ #wenyan pre code {
103
+ font-family: var(--monospace-font);
104
+ display: block;
105
+ overflow-x: auto;
106
+ margin: .5em;
107
+ padding: 0;
108
+ background: #f8f8f8;
109
+ }
110
+ #wenyan hr {
111
+ border: none;
112
+ border-top: 1px solid #ddd;
113
+ margin-top: 32px;
114
+ margin-bottom: 32px;
115
+ }
116
+ /* 链接 */
117
+ #wenyan a {
118
+ word-wrap: break-word;
119
+ color: #0069c2;
120
+ }
121
+ /* 脚注 */
122
+ #wenyan #footnotes ul {
123
+ font-size: 0.9em;
124
+ margin: 0;
125
+ padding-left: 1.2em;
126
+ }
127
+ #wenyan #footnotes li {
128
+ margin: 0 0 0 1.2em;
129
+ overflow-wrap: break-word;
130
+ word-wrap: break-word;
131
+ word-break: break-all;
132
+ }
133
+ #wenyan .footnote {
134
+ color: #0069c2;
135
+ }
136
+ `;
137
+ export {
138
+ n as default
139
+ };
@@ -0,0 +1,135 @@
1
+ const n = `:root {
2
+ --sans-serif-font: source-serif-pro, Georgia, Cambria, "Times New Roman", Times, serif;
3
+ --monospace-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "liberation mono", "courier new", monospace;
4
+ }
5
+ #wenyan {
6
+ font-family: var(--sans-serif-font);
7
+ line-height: 1.75;
8
+ font-size: 16px;
9
+ }
10
+ #wenyan * {
11
+ box-sizing: border-box;
12
+ }
13
+ #wenyan h1,
14
+ #wenyan h2,
15
+ #wenyan h3,
16
+ #wenyan h4,
17
+ #wenyan h5,
18
+ #wenyan h6 {
19
+ font-family: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif;
20
+ margin: 1em 0;
21
+ }
22
+ #wenyan h1 {
23
+ font-size: 2em;
24
+ font-weight: 700;
25
+ }
26
+ #wenyan h2,
27
+ #wenyan h3 {
28
+ font-size: 1.3em;
29
+ font-weight: 700;
30
+ }
31
+ #wenyan h4,
32
+ #wenyan h5,
33
+ #wenyan h6 {
34
+ font-size: 1.2em;
35
+ font-weight: 700;
36
+ }
37
+ #wenyan p {
38
+ letter-spacing: -0.003em;
39
+ margin: 1em 0;
40
+ }
41
+ #wenyan ul,
42
+ #wenyan ol {
43
+ padding-left: 1.2em;
44
+ }
45
+ #wenyan li {
46
+ margin-left: 1.2em;
47
+ }
48
+ #wenyan img {
49
+ max-width: 100%;
50
+ height: auto;
51
+ margin: 0 auto;
52
+ display: block;
53
+ }
54
+ #wenyan table {
55
+ border-collapse: collapse;
56
+ font-size: 15px;
57
+ margin: 1.4em auto;
58
+ max-width: 100%;
59
+ table-layout: fixed;
60
+ text-align: left;
61
+ width: 100%;
62
+ word-wrap: break-word;
63
+ word-break: break-all;
64
+ }
65
+ #wenyan table th {
66
+ background: #ebeced;
67
+ color: #191b1f;
68
+ font-weight: 500;
69
+ }
70
+ #wenyan table td,
71
+ #wenyan table th {
72
+ border: 1px solid #c4c7ce;
73
+ height: 24px;
74
+ line-height: 24px;
75
+ padding: 3px 12px;
76
+ }
77
+ #wenyan blockquote {
78
+ letter-spacing: -0.003em;
79
+ border-left: 3px solid rgba(0, 0, 0, 0.84);
80
+ padding-left: 20px;
81
+ margin: 0 0 20px 0;
82
+ }
83
+ #wenyan p code {
84
+ padding: 4px 6px;
85
+ font-size: 0.78em;
86
+ border-radius: 3px;
87
+ font-family: var(--monospace-font);
88
+ background-color: #f2f2f2;
89
+ }
90
+ #wenyan pre {
91
+ line-height: 2;
92
+ margin: 1em 0.5em;
93
+ padding: 1em;
94
+ background: #f9f9f9;
95
+ border-radius: 4px;
96
+ border: 1px solid #e5e5e5;
97
+ }
98
+ #wenyan pre code {
99
+ display: block;
100
+ overflow-x: auto;
101
+ margin: .5em;
102
+ padding: 0;
103
+ font-family: var(--monospace-font);
104
+ background: #f9f9f9;
105
+ }
106
+ #wenyan hr {
107
+ border: none;
108
+ border-top: 1px solid #c4c7ce;
109
+ margin: 2em auto;
110
+ max-width: 100%;
111
+ width: 240px;
112
+ }
113
+ /* 链接 */
114
+ #wenyan a {
115
+ word-wrap: break-word;
116
+ color: #000000;
117
+ }
118
+ /* 脚注 */
119
+ #wenyan #footnotes ul {
120
+ font-size: 0.9em;
121
+ margin: 0;
122
+ padding-left: 1.2em;
123
+ }
124
+ #wenyan #footnotes li {
125
+ margin: 0 0 0 1.2em;
126
+ word-wrap: break-word;
127
+ word-break: break-all;
128
+ }
129
+ #wenyan .footnote {
130
+ color: #000000;
131
+ }
132
+ `;
133
+ export {
134
+ n as default
135
+ };
package/dist/theme.js CHANGED
@@ -1,65 +1,107 @@
1
- const a = [
1
+ const i = [
2
2
  {
3
3
  id: "default",
4
4
  name: "Default",
5
- description: "A clean, classic layout ideal for long-form reading."
5
+ description: "A clean, classic layout ideal for long-form reading.",
6
+ appName: "默认",
7
+ author: ""
6
8
  },
7
9
  {
8
10
  id: "orangeheart",
9
11
  name: "OrangeHeart",
10
- description: "A vibrant and elegant theme in warm orange tones."
12
+ description: "A vibrant and elegant theme in warm orange tones.",
13
+ appName: "Orange Heart",
14
+ author: "evgo2017"
11
15
  },
12
16
  {
13
17
  id: "rainbow",
14
18
  name: "Rainbow",
15
- description: "A colorful, lively theme with a clean layout."
19
+ description: "A colorful, lively theme with a clean layout.",
20
+ appName: "Rainbow",
21
+ author: "thezbm"
16
22
  },
17
23
  {
18
24
  id: "lapis",
19
25
  name: "Lapis",
20
- description: "A minimal and refreshing theme in cool blue tones."
26
+ description: "A minimal and refreshing theme in cool blue tones.",
27
+ appName: "Lapis",
28
+ author: "YiNN"
21
29
  },
22
30
  {
23
31
  id: "pie",
24
32
  name: "Pie",
25
- description: "Inspired by sspai.com and Misty — modern, sharp, and stylish."
33
+ description: "Inspired by sspai.com and Misty — modern, sharp, and stylish.",
34
+ appName: "Pie",
35
+ author: "kevinzhao2233"
26
36
  },
27
37
  {
28
38
  id: "maize",
29
39
  name: "Maize",
30
- description: "A crisp, light theme with a soft maize palette."
40
+ description: "A crisp, light theme with a soft maize palette.",
41
+ appName: "Maize",
42
+ author: "BEATREE"
31
43
  },
32
44
  {
33
45
  id: "purple",
34
46
  name: "Purple",
35
- description: "Clean and minimalist, with a subtle purple accent."
47
+ description: "Clean and minimalist, with a subtle purple accent.",
48
+ appName: "Purple",
49
+ author: "hliu202"
36
50
  },
37
51
  {
38
52
  id: "phycat",
39
- name: "phycat",
40
- description: "物理猫-薄荷:a mint-green theme with clear structure and hierarchy."
53
+ name: "Phycat",
54
+ description: "物理猫-薄荷:a mint-green theme with clear structure and hierarchy.",
55
+ appName: "物理猫-薄荷",
56
+ author: "sumruler"
41
57
  }
42
- ], n = /* @__PURE__ */ Object.assign({
58
+ ], a = /* @__PURE__ */ Object.assign({
43
59
  "./themes/default.css": () => import("./default-D-dyLptq.js").then((e) => e.default),
60
+ "./themes/juejin_default.css": () => import("./juejin_default-CnUAGV72.js").then((e) => e.default),
44
61
  "./themes/lapis.css": () => import("./lapis-dRySN5pK.js").then((e) => e.default),
45
62
  "./themes/maize.css": () => import("./maize-DFW0x6O3.js").then((e) => e.default),
63
+ "./themes/medium_default.css": () => import("./medium_default-BXHGUKdY.js").then((e) => e.default),
46
64
  "./themes/orangeheart.css": () => import("./orangeheart-Da7uQj8U.js").then((e) => e.default),
47
65
  "./themes/phycat.css": () => import("./phycat-BGGT9oBk.js").then((e) => e.default),
48
66
  "./themes/pie.css": () => import("./pie-DUYodGli.js").then((e) => e.default),
49
67
  "./themes/purple.css": () => import("./purple-Da1-Vfos.js").then((e) => e.default),
50
- "./themes/rainbow.css": () => import("./rainbow-BtrbZco6.js").then((e) => e.default)
51
- }), s = {};
52
- for (const e of a) {
53
- const i = `./themes/${e.id}.css`, t = n[i];
54
- t ? s[e.id] = {
68
+ "./themes/rainbow.css": () => import("./rainbow-BtrbZco6.js").then((e) => e.default),
69
+ "./themes/toutiao_default.css": () => import("./toutiao_default-DthFV93V.js").then((e) => e.default),
70
+ "./themes/zhihu_default.css": () => import("./zhihu_default-7uVAZjKn.js").then((e) => e.default)
71
+ });
72
+ function n(e) {
73
+ const s = `./themes/${e.id}.css`, t = a[s];
74
+ return t ? {
55
75
  ...e,
56
76
  getCss: t
57
- } : console.warn(`[Themes] CSS file not found for theme: ${e.id}`);
77
+ } : (console.warn(`[Themes] CSS file not found for theme: ${e.id}`), null);
58
78
  }
79
+ const r = Object.fromEntries(
80
+ i.map((e) => n(e)).filter((e) => e !== null).map((e) => [e.id, e])
81
+ );
59
82
  function o() {
60
- return Object.values(s);
83
+ return Object.values(r);
61
84
  }
85
+ const m = [
86
+ "juejin_default",
87
+ "medium_default",
88
+ "toutiao_default",
89
+ "zhihu_default"
90
+ ], h = Object.fromEntries(
91
+ m.map((e) => [
92
+ e,
93
+ {
94
+ id: e,
95
+ name: "",
96
+ description: "",
97
+ appName: "",
98
+ author: "",
99
+ getCss: a[`./themes/${e}.css`]
100
+ }
101
+ ])
102
+ );
62
103
  export {
63
104
  o as getAllThemes,
64
- s as themes
105
+ h as otherThemes,
106
+ r as themes
65
107
  };
@@ -0,0 +1,151 @@
1
+ const n = `:root {
2
+ --sans-serif-font: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
3
+ "Noto Color Emoji";
4
+ --monospace-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "liberation mono", "courier new", monospace;
5
+ }
6
+ #wenyan {
7
+ font-family: var(--sans-serif-font);
8
+ line-height: 1.75;
9
+ }
10
+ #wenyan * {
11
+ box-sizing: border-box;
12
+ }
13
+ #wenyan h1,
14
+ #wenyan h2,
15
+ #wenyan h3,
16
+ #wenyan h4,
17
+ #wenyan h5,
18
+ #wenyan h6,
19
+ #wenyan p,
20
+ #wenyan pre {
21
+ margin: 1em 0;
22
+ }
23
+ #wenyan h1,
24
+ #wenyan h2,
25
+ #wenyan h3,
26
+ #wenyan h4,
27
+ #wenyan h5,
28
+ #wenyan h6 {
29
+ font-size: 18px;
30
+ line-height: 30px;
31
+ margin-top: 20px;
32
+ margin-bottom: 12px;
33
+ font-weight: 700;
34
+ position: relative;
35
+ }
36
+ #wenyan h1:before,
37
+ #wenyan h2:before,
38
+ #wenyan h3:before,
39
+ #wenyan h4:before,
40
+ #wenyan h5:before,
41
+ #wenyan h6:before {
42
+ content: "";
43
+ display: inline-block;
44
+ vertical-align: 1px;
45
+ width: 16px;
46
+ height: 20px;
47
+ margin-right: 6px;
48
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT7kuInop5LlvaI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0i5LiJ6KeS5b2iIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cGF0aCBkPSJNNi4zNTc0OTI5Myw0LjQyOTE1NDg4IEwxMC41OTEzMDI1LDExLjQ4NTUwNDIgQzEwLjg3NTQ1MDcsMTEuOTU5MDg0NSAxMC43MjE4ODU2LDEyLjU3MzM0NDggMTAuMjQ4MzA1NCwxMi44NTc0OTI5IEMxMC4wOTI4OSwxMi45NTA3NDIyIDkuOTE1MDUzNTcsMTMgOS43MzM4MDk2MiwxMyBMMS4yNjYxOTAzOCwxMyBDMC43MTM5MDU2MjksMTMgMC4yNjYxOTAzNzksMTIuNTUyMjg0NyAwLjI2NjE5MDM3OSwxMiBDMC4yNjYxOTAzNzksMTEuODE4NzU2MSAwLjMxNTQ0ODIxMiwxMS42NDA5MTk2IDAuNDA4Njk3NDUzLDExLjQ4NTUwNDIgTDQuNjQyNTA3MDcsNC40MjkxNTQ4OCBDNC45MjY2NTUyMywzLjk1NTU3NDYxIDUuNTQwOTE1NDksMy44MDIwMDk1NSA2LjAxNDQ5NTc2LDQuMDg2MTU3NzEgQzYuMTU1MjQ1MzYsNC4xNzA2MDc0NyA2LjI3MzA0MzE2LDQuMjg4NDA1MjcgNi4zNTc0OTI5Myw0LjQyOTE1NDg4IFoiIGZpbGw9IiNGRjVFNUUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDUuNTAwMDAwLCA4LjAwMDAwMCkgcm90YXRlKC0yNzAuMDAwMDAwKSB0cmFuc2xhdGUoLTUuNTAwMDAwLCAtOC4wMDAwMDApICI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4=);
49
+ background-repeat: no-repeat;
50
+ background-size: 16px 16px;
51
+ background-position-y: 6px;
52
+ }
53
+ #wenyan ul,
54
+ #wenyan ol {
55
+ padding-left: 1.2em;
56
+ }
57
+ #wenyan li {
58
+ margin-left: 1.2em;
59
+ }
60
+ #wenyan img {
61
+ max-width: 100%;
62
+ height: auto;
63
+ margin: 0 auto;
64
+ display: block;
65
+ }
66
+ #wenyan table {
67
+ margin-left: auto;
68
+ margin-right: auto;
69
+ border-collapse: collapse;
70
+ table-layout: fixed;
71
+ overflow: auto;
72
+ border-spacing: 0;
73
+ font-size: 1em;
74
+ word-wrap: break-word;
75
+ word-break: break-all;
76
+ }
77
+ #wenyan table td,
78
+ #wenyan table th {
79
+ height: 40px;
80
+ padding: 9px 12px;
81
+ line-height: 22px;
82
+ color: #222;
83
+ min-width: 88px;
84
+ border: 1px solid #d8d8d8;
85
+ vertical-align: top;
86
+ }
87
+ #wenyan blockquote {
88
+ margin: 0;
89
+ margin-bottom: 20px;
90
+ padding: 0 16px;
91
+ position: relative;
92
+ color: #999;
93
+ text-align: justify;
94
+ }
95
+ #wenyan blockquote:before {
96
+ content: " ";
97
+ left: 0;
98
+ position: absolute;
99
+ width: 2px;
100
+ height: 100%;
101
+ background: #f2f2f2;
102
+ }
103
+ #wenyan p code {
104
+ font-family: var(--monospace-font);
105
+ color: #1e6bb8;
106
+ }
107
+ /* 代码块 */
108
+ #wenyan pre {
109
+ border-radius: 3px;
110
+ border: 1px solid #e8e8e8;
111
+ line-height: 2;
112
+ margin: 1em 0.5em;
113
+ padding: .5em;
114
+ }
115
+ #wenyan pre code {
116
+ font-family: var(--monospace-font);
117
+ display: block;
118
+ overflow-x: auto;
119
+ margin: .5em;
120
+ padding: 0;
121
+ }
122
+ #wenyan hr {
123
+ width: 100%;
124
+ height: 1px;
125
+ background-color: #e8e8e8;
126
+ border: none;
127
+ margin: 20px 0;
128
+ }
129
+ /* 链接 */
130
+ #wenyan a {
131
+ word-wrap: break-word;
132
+ color: #0069c2;
133
+ }
134
+ /* 脚注 */
135
+ #wenyan #footnotes ul {
136
+ font-size: 0.9em;
137
+ margin: 0;
138
+ padding-left: 1.2em;
139
+ }
140
+ #wenyan #footnotes li {
141
+ margin: 0 0 0 1.2em;
142
+ word-wrap: break-word;
143
+ word-break: break-all;
144
+ }
145
+ #wenyan .footnote {
146
+ color: #0069c2;
147
+ }
148
+ `;
149
+ export {
150
+ n as default
151
+ };
@@ -2,7 +2,10 @@ export type Theme = {
2
2
  id: string;
3
3
  name: string;
4
4
  description: string;
5
+ appName: string;
6
+ author: string;
5
7
  getCss: () => Promise<string>;
6
8
  };
7
9
  export declare const themes: Record<string, Theme>;
8
10
  export declare function getAllThemes(): Theme[];
11
+ export declare const otherThemes: Record<string, Theme>;
package/dist/wrapper.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { JSDOM as a } from "jsdom";
2
- import { configureMarked as s, handleFrontMatter as m, renderMarkdown as w, getContentForGzh as l } from "./core.js";
3
- async function f(n, o, e, r) {
4
- s();
5
- const t = m(n), c = await w(t.body), d = new a(`<body><section id="wenyan">${c}</section></body>`).window.document, i = await l(d, o, e, r);
2
+ import { configureMarked as m, handleFrontMatter as s, renderMarkdown as w, getContentForGzhBuiltinTheme as l } from "./core.js";
3
+ async function f(n, e, o, r) {
4
+ m();
5
+ const t = s(n), c = await w(t.body), d = new a(`<body><section id="wenyan">${c}</section></body>`).window.document.getElementById("wenyan"), i = await l(d, e, o, r);
6
6
  return {
7
7
  title: t.title,
8
8
  cover: t.cover,
@@ -0,0 +1,138 @@
1
+ const n = `:root {
2
+ --sans-serif-font: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
3
+ "Noto Color Emoji";
4
+ --monospace-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "liberation mono", "courier new", monospace;
5
+ }
6
+ #wenyan {
7
+ font-family: var(--sans-serif-font);
8
+ line-height: 1.75;
9
+ font-size: 16px;
10
+ }
11
+ #wenyan * {
12
+ box-sizing: border-box;
13
+ }
14
+ #wenyan h1,
15
+ #wenyan h2,
16
+ #wenyan h3,
17
+ #wenyan h4,
18
+ #wenyan h5,
19
+ #wenyan h6,
20
+ #wenyan p,
21
+ #wenyan pre {
22
+ margin: 1em 0;
23
+ }
24
+ #wenyan h1,
25
+ #wenyan h2 {
26
+ clear: left;
27
+ font-size: 1.2em;
28
+ font-weight: 600;
29
+ line-height: 1.5;
30
+ margin-bottom: 1.16667em;
31
+ margin-top: 2.33333em;
32
+ }
33
+ #wenyan h3,
34
+ #wenyan h4,
35
+ #wenyan h5,
36
+ #wenyan h6 {
37
+ clear: left;
38
+ font-size: 1.1em;
39
+ font-weight: 600;
40
+ line-height: 1.5;
41
+ margin-bottom: 1.27273em;
42
+ margin-top: 1.90909em;
43
+ }
44
+ #wenyan ul,
45
+ #wenyan ol {
46
+ padding-left: 1.2em;
47
+ }
48
+ #wenyan li {
49
+ margin-left: 1.2em;
50
+ }
51
+ #wenyan img {
52
+ max-width: 100%;
53
+ height: auto;
54
+ margin: 0 auto;
55
+ display: block;
56
+ }
57
+ #wenyan table {
58
+ border-collapse: collapse;
59
+ font-size: 15px;
60
+ margin: 1.4em auto;
61
+ max-width: 100%;
62
+ table-layout: fixed;
63
+ text-align: left;
64
+ width: 100%;
65
+ word-wrap: break-word;
66
+ word-break: break-all;
67
+ }
68
+ #wenyan table th {
69
+ background: #ebeced;
70
+ color: #191b1f;
71
+ font-weight: 500;
72
+ }
73
+ #wenyan table td,
74
+ #wenyan table th {
75
+ border: 1px solid #c4c7ce;
76
+ height: 24px;
77
+ line-height: 24px;
78
+ padding: 3px 12px;
79
+ }
80
+ #wenyan blockquote {
81
+ border-left: 3px solid #c4c7ce;
82
+ margin: 1.5em 0;
83
+ padding: 0 0 1em 1em;
84
+ color: #535861;
85
+ }
86
+ #wenyan code {
87
+ margin: 0px 2px;
88
+ padding: 3px 4px;
89
+ border-radius: 3px;
90
+ font-family: var(--monospace-font);
91
+ background-color: rgb(246, 246, 246);
92
+ }
93
+ #wenyan pre {
94
+ word-wrap: normal;
95
+ background: #f8f8fa;
96
+ border-radius: 4px;
97
+ line-height: 2;
98
+ margin: 1em 0.5em;
99
+ padding: .5em;
100
+ white-space: pre;
101
+ word-break: normal;
102
+ }
103
+ #wenyan pre code {
104
+ display: block;
105
+ overflow-x: auto;
106
+ margin: .5em;
107
+ padding: 0;
108
+ }
109
+ #wenyan hr {
110
+ border: none;
111
+ border-top: 1px solid #c4c7ce;
112
+ margin: 2em auto;
113
+ max-width: 100%;
114
+ width: 240px;
115
+ }
116
+ /* 链接 */
117
+ #wenyan a {
118
+ word-wrap: break-word;
119
+ color: #0069c2;
120
+ }
121
+ /* 脚注 */
122
+ #wenyan #footnotes ul {
123
+ font-size: 0.9em;
124
+ margin: 0;
125
+ padding-left: 1.2em;
126
+ }
127
+ #wenyan #footnotes li {
128
+ margin: 0 0 0 1.2em;
129
+ word-wrap: break-word;
130
+ word-break: break-all;
131
+ }
132
+ #wenyan .footnote {
133
+ color: #0069c2;
134
+ }
135
+ `;
136
+ export {
137
+ n as default
138
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wenyan-md/core",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Core library for Wenyan markdown rendering & publishing",
5
5
  "author": "Lei <caol64@gmail.com> (https://github.com/caol64)",
6
6
  "license": "Apache-2.0",
@@ -17,14 +17,27 @@
17
17
  "files": [
18
18
  "dist"
19
19
  ],
20
- "main": "./dist/core.js",
21
- "module": "./dist/core.js",
22
20
  "exports": {
23
- ".": "./dist/core.js",
24
- "./publish": "./dist/publish.js",
25
- "./wrapper": "./dist/wrapper.js",
26
- "./theme": "./dist/theme.js",
27
- "./hltheme": "./dist/hltheme.js"
21
+ ".": {
22
+ "import": "./dist/core.js",
23
+ "browser": "./dist/browser/wenyan-core.js"
24
+ },
25
+ "./publish": {
26
+ "import": "./dist/publish.js",
27
+ "types": "./dist/types/publish.d.ts"
28
+ },
29
+ "./wrapper": {
30
+ "import": "./dist/wrapper.js",
31
+ "types": "./dist/types/wrapper.d.ts"
32
+ },
33
+ "./theme": {
34
+ "import": "./dist/theme.js",
35
+ "types": "./dist/types/theme.d.ts"
36
+ },
37
+ "./hltheme": {
38
+ "import": "./dist/hltheme.js",
39
+ "types": "./dist/types/hltheme.d.ts"
40
+ }
28
41
  },
29
42
  "devDependencies": {
30
43
  "@types/css-tree": "^2.3.10",
@@ -48,8 +61,10 @@
48
61
  "scripts": {
49
62
  "dev": "vite build --watch",
50
63
  "build": "vite build && tsc",
51
- "testMain": "vitest run main.test.js",
52
- "testWrapper": "vitest run wrapper.test.js",
53
- "testPublish": "vitest run publish.test.js"
64
+ "build:browser": "vite build --config vite.config.browser.ts",
65
+ "build:all": "pnpm build && pnpm build:browser",
66
+ "test:main": "pnpm build && vitest run main.test.js",
67
+ "test:wrapper": "pnpm build && vitest run wrapper.test.js",
68
+ "test:publish": "pnpm build && vitest run publish.test.js"
54
69
  }
55
70
  }
@@ -1 +0,0 @@
1
- export {};