@sugarat/create-theme 0.0.107 → 0.0.108

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.
@@ -285,6 +285,180 @@ const blogTheme = getThemeConfig({
285
285
  })
286
286
  ```
287
287
 
288
+ ## card - 产品/项目卡片
289
+ * Type: `boolean | ProductCardOptions`
290
+ * default: `true`
291
+
292
+ ::: tip
293
+ 底层由独立插件 [vitepress-plugin-product-card](https://theme.sugarat.top/plugins/vitepress-plugin-product-card.html) 提供,你也可以在非本主题项目中单独使用。
294
+ :::
295
+
296
+ 提供 markdown `::: card` 容器语法,用于在文章中快速展示产品/项目/工具卡片列表(如首页 "我的产品")。
297
+
298
+ 效果如下
299
+
300
+ ::: card 我的产品
301
+
302
+ - icon: 🍬
303
+ iconColor: "#f5d24a"
304
+ title: 博客主题 @sugarat/theme
305
+ link: https://theme.sugarat.top
306
+ github: https://github.com/ATQQ/sugar-blog
307
+ tags: [Vitepress, Vue, Theme]
308
+ desc: 基于 **VitePress** 实现的简约风博客主题,开箱即用,支持深色模式、评论、RSS、Pagefind 全文搜索等。
309
+
310
+ ----
311
+
312
+ - icon: 📥
313
+ iconColor: "#4f8cff"
314
+ title: EasyPicker(轻取)
315
+ link: https://docs.ep.sugarat.top
316
+ github: https://github.com/ATQQ/easypicker2-client
317
+ tags: [Vue, 工具]
318
+ desc: 在线文件收集系统,一站式存储、无需注册即可提交,支持 [私有化部署](https://docs.ep.sugarat.top/deploy/)。
319
+
320
+ ----
321
+
322
+ - icon: ✍️
323
+ iconColor: "#ff8f6b"
324
+ title: 个人博客
325
+ link: https://sugarat.top
326
+ github: https://github.com/ATQQ/sugar-blog
327
+ tags: [Vitepress, Vue, Blog]
328
+ desc: 记录随笔与学习笔记的地方,同步更新在 [掘金](https://juejin.cn/user/1028798615918983)。
329
+
330
+ ----
331
+
332
+ - icon: 🖼️
333
+ iconColor: "#7cd6a4"
334
+ title: 七牛云 OSS 图床
335
+ link: https://imgbed.sugarat.top/
336
+ github: https://github.com/ATQQ/image-bed-qiniu
337
+ tags: [Vue, 工具]
338
+ desc: 基于七牛云对象存储服务搭建的图床应用,前端纯静态,无需后端。
339
+
340
+ :::
341
+
342
+ 语法如下
343
+
344
+ ````md
345
+ ::: card 我的产品
346
+
347
+ - icon: 🍬
348
+ iconColor: "#f5d24a"
349
+ title: 博客主题 @sugarat/theme
350
+ link: https://theme.sugarat.top
351
+ github: https://github.com/ATQQ/sugar-blog
352
+ tags: [Vitepress, Vue, Theme]
353
+ desc: 基于 **VitePress** 实现的简约风博客主题,开箱即用,支持深色模式、评论、RSS、Pagefind 全文搜索等。
354
+
355
+ ----
356
+
357
+ - icon: 📥
358
+ iconColor: "#4f8cff"
359
+ title: EasyPicker(轻取)
360
+ link: https://docs.ep.sugarat.top
361
+ github: https://github.com/ATQQ/easypicker2-client
362
+ tags: [Vue, 工具]
363
+ desc: 在线文件收集系统,一站式存储、无需注册即可提交,支持 [私有化部署](https://docs.ep.sugarat.top/deploy/)。
364
+
365
+ ----
366
+
367
+ - icon: ✍️
368
+ iconColor: "#ff8f6b"
369
+ title: 个人博客
370
+ link: https://sugarat.top
371
+ github: https://github.com/ATQQ/sugar-blog
372
+ tags: [Vitepress, Vue, Blog]
373
+ desc: 记录随笔与学习笔记的地方,同步更新在 [掘金](https://juejin.cn/user/1028798615918983)。
374
+
375
+ ----
376
+
377
+ - icon: 🖼️
378
+ iconColor: "#7cd6a4"
379
+ title: 七牛云 OSS 图床
380
+ link: https://imgbed.sugarat.top/
381
+ github: https://github.com/ATQQ/image-bed-qiniu
382
+ tags: [Vue, 工具]
383
+ desc: 基于七牛云对象存储服务搭建的图床应用,前端纯静态,无需后端。
384
+
385
+ :::
386
+ ````
387
+
388
+ 字段说明:
389
+ - `icon`:图标,支持图片 URL(http/https 或以 `/` 开头的站内绝对路径)或单个字符(配合 `iconColor` 作为底色)
390
+ - `iconColor`:字符图标的背景色,可选
391
+ - `title`:卡片标题(必填)
392
+ - `link`:跳转链接,可选,命中时点击标题在新标签打开
393
+ - `github`:GitHub 仓库地址,可选。填写后组件挂载时会自动请求 `https://api.github.com/repos/{owner}/{repo}` 获取创建 / 最后更新时间并展示
394
+ - `showCreated` / `showUpdated`:布尔值,可选。单卡覆盖全局开关(默认均为 `true`)
395
+ - `tags`:标签数组,形如 `[a, b, "包含空格的标签"]`
396
+ - `desc`:描述,支持内联 Markdown(如 `**加粗**`、`[链接](url)`)
397
+
398
+ 多张卡片之间使用一行 `----`(4 个及以上短横线)分隔。
399
+
400
+ ### GitHub 时间自动展示
401
+
402
+ 当卡片配置了 `github` 字段时,会调用 GitHub 公开 API 自动拉取仓库的创建时间与最后更新时间(`created_at` / `pushed_at`),并以 `YYYY-MM-DD` 格式展示在描述下方。默认两者都开启,可以:
403
+
404
+ - **全局关闭**创建/更新时间中的任意一个:
405
+
406
+ ```ts
407
+ // .vitepress/blog-theme.ts
408
+ const blogTheme = getThemeConfig({
409
+ productCard: {
410
+ showCreated: false,
411
+ showUpdated: true
412
+ }
413
+ })
414
+ ```
415
+
416
+ - **单卡覆盖**(在容器语法内声明,优先级高于全局):
417
+
418
+ ```md
419
+ ::: card
420
+
421
+ - title: 只显示更新时间
422
+ github: https://github.com/owner/repo
423
+ showCreated: false
424
+
425
+ :::
426
+ ```
427
+
428
+ > 注意:GitHub 匿名接口有 60 次/小时 IP 限流;请求失败时时间信息会静默隐藏。
429
+
430
+ 不需要该功能也可以整体关闭
431
+
432
+ ```ts
433
+ // .vitepress/blog-theme.ts
434
+ const blogTheme = getThemeConfig({
435
+ productCard: false
436
+ })
437
+ ```
438
+
439
+ `ProductCardOptions` 与 `ProductCardItem` 类型定义如下
440
+
441
+ ```ts
442
+ interface ProductCardOptions {
443
+ /** 是否展示 GitHub 仓库创建时间,默认 true */
444
+ showCreated?: boolean
445
+ /** 是否展示 GitHub 仓库最后更新时间,默认 true */
446
+ showUpdated?: boolean
447
+ }
448
+
449
+ interface ProductCardItem {
450
+ icon?: string
451
+ iconColor?: string
452
+ title: string
453
+ link?: string
454
+ github?: string
455
+ tags?: string[]
456
+ descHtml?: string
457
+ showCreated?: boolean
458
+ showUpdated?: boolean
459
+ }
460
+ ```
461
+
288
462
  ## Mermaid - 图表
289
463
  * Type: `boolean`|`object`
290
464
 
@@ -10,7 +10,7 @@
10
10
  "serve": "vitepress serve docs"
11
11
  },
12
12
  "dependencies": {
13
- "@sugarat/theme": "^0.5.28"
13
+ "@sugarat/theme": "^0.5.29"
14
14
  },
15
15
  "directories": {
16
16
  "doc": "docs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/create-theme",
3
- "version": "0.0.107",
3
+ "version": "0.0.108",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "粥里有勺糖",
6
6
  "license": "MIT",