@wanlianyida/portal-kit 0.1.4 → 0.1.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/README.md CHANGED
@@ -129,7 +129,7 @@ H1/H2 进入目录,H3–H6 也有锚点。**docs 迁移时传 `id-prefix=""`
129
129
  - 有序/无序列表、嵌套列表、只读任务列表及段首全角空格缩进。
130
130
  - 普通引用及 `[!NOTE]`、`[!WARNING]`、`[!CAUTION]` 提示块,对应信息、提醒、警告;自定义提示标题保留。
131
131
  - 任意列数的表格,保留列对齐,滚动容器可通过键盘聚焦。
132
- - 代码卡片、JSON 高亮和原文复制;未注册的语言回退纯文本,保留缩进与内部换行。普通换行按 Markdown 段落规则处理,强制换行使用行末两个空格或 `<br>`。
132
+ - 代码卡片、常见请求代码语言高亮和原文复制;语言为空或未注册时自动探测,无法高亮时安全回退原文,保留缩进与内部换行。普通换行按 Markdown 段落规则处理,强制换行使用行末两个空格或 `<br>`。
133
133
 
134
134
  ### 两端接入
135
135
 
@@ -190,7 +190,7 @@ pnpm build
190
190
  npm pack --dry-run
191
191
  ```
192
192
 
193
- 开发栈沿用 Vue 3 Composition API、TypeScript strict、Vite 库模式及类型声明生成。`vue` 和 `element-plus` 由宿主提供;marked、DOMPurify 和 highlight.js 随库构建,JSON 按需注册,无需额外加载 CDN。
193
+ 开发栈沿用 Vue 3 Composition API、TypeScript strict、Vite 库模式及类型声明生成。`vue` 和 `element-plus` 由宿主提供;marked、DOMPurify 和 highlight.js 随库构建,代码块按需注册 bash、go、http、java、javascript、json、plaintext、python、sql、typescript、xml、yaml,无需额外加载 CDN。
194
194
 
195
195
  `pnpm dev` 后进入「正文预览」,可编辑 Markdown、切换窄屏和交互语言,检查代码复制、表格、提示块及划线评论组合。该示例未配置 webhook,评论只用于本地体验,不会发往反馈通道。
196
196
 
package/dist/index.d.ts CHANGED
@@ -78,6 +78,23 @@ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
78
78
 
79
79
  export declare function buildFeedbackPayload(input: FeedbackInput, now?: Date): FeedbackPayload;
80
80
 
81
+ /** 公共代码主题使用的 token 分组,供可编辑文本范围与预览 HTML 共用。 */
82
+ export declare const CODE_HIGHLIGHT_CLASSES: {
83
+ readonly comment: readonly ["hljs-comment", "hljs-quote"];
84
+ readonly keyword: readonly ["hljs-keyword", "hljs-doctag", "hljs-selector-tag"];
85
+ readonly attr: readonly ["hljs-attr", "hljs-attribute"];
86
+ readonly string: readonly ["hljs-string", "hljs-regexp", "hljs-template-tag"];
87
+ readonly number: readonly ["hljs-number"];
88
+ readonly literal: readonly ["hljs-literal", "hljs-symbol", "hljs-bullet"];
89
+ readonly title: readonly ["hljs-title", "hljs-section", "hljs-selector-id", "hljs-selector-class"];
90
+ readonly punctuation: readonly ["hljs-punctuation"];
91
+ readonly variable: readonly ["hljs-variable", "hljs-template-variable"];
92
+ readonly builtin: readonly ["hljs-built_in", "hljs-type"];
93
+ readonly tag: readonly ["hljs-name", "hljs-tag"];
94
+ readonly meta: readonly ["hljs-meta"];
95
+ readonly plain: readonly ["hljs-subst"];
96
+ };
97
+
81
98
  export declare const CodePreview: DefineComponent<CodePreviewProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CodePreviewProps> & Readonly<{}>, {
82
99
  title: string;
83
100
  locale: string;
@@ -87,7 +104,7 @@ language: string;
87
104
  export declare interface CodePreviewProps {
88
105
  code: string;
89
106
  title?: string;
90
- /** 首期注册 JSON 高亮;其它语言保留原文展示。 */
107
+ /** 支持常见请求代码语言;为空或未注册时自动探测。 */
91
108
  language?: string;
92
109
  locale?: string;
93
110
  }
@@ -189,6 +206,12 @@ export declare interface HeadingSection {
189
206
  level: number;
190
207
  }
191
208
 
209
+ /**
210
+ * 对代码进行安全高亮。语言为空或未注册时使用 highlightAuto,失败则返回空串,
211
+ * 由组件用 Vue 插值安全展示原文。
212
+ */
213
+ export declare function highlightCode(code: string, language?: string): string;
214
+
192
215
  /** 只接受飞书 / Lark 的 https 地址,避免把企业名和页面路径发到任意域名。 */
193
216
  export declare function isFeishuWebhook(url: string): boolean;
194
217