MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / htmlEscape

Function htmlEscape

javdb/javdb.ts:30–37  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

28/** Telegram 消息最大长度限制 */
29const MAX_MESSAGE_LENGTH = 4096;
30
31/** HTML 转义函数(安全处理用户输入)*/
32/** 分割 HTML 文本为多个分段(避免超过长度限制)*/
33function chunkHtml(text: string, limit = MAX_MESSAGE_LENGTH): string[] {
34 if (text.length <= limit) return [text];
35 const out: string[] = [];
36 let buf = "";
37 for (const ch of text) {
38 buf += ch;
39 if (buf.length >= limit - 16) {
40 let cut = Math.max(buf.lastIndexOf("\n"), buf.lastIndexOf(" "));

Callers 1

handleAvMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected