@telegram.ts/formatters
Advanced tools
| declare function bold(text: string): string; | ||
| declare function italic(text: string): string; | ||
| declare function underline(text: string): string; | ||
| declare function strikethrough(text: string): string; | ||
| declare function spoiler(text: string): string; | ||
| declare function blockquote(text: string): string; | ||
| declare function expandableBlockquote(text: string): string; | ||
| declare function inlineURL(text: string, url: string): string; | ||
| declare function inlineMention(text: string, userId: number): string; | ||
| declare function inlineCode(text: string): string; | ||
| declare function codeBlock(text: string, language?: string): string; | ||
| declare function inlineEmoji(emoji: string, emojiId: string): string; | ||
| declare function combine(parts: string[], separator?: string): string; | ||
| declare function list(items: string[], ordered?: boolean): string; | ||
| export { bold, italic, underline, strikethrough, spoiler, blockquote, expandableBlockquote, inlineURL, inlineMention, inlineCode, codeBlock, inlineEmoji, combine, list, }; |
+67
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.bold = bold; | ||
| exports.italic = italic; | ||
| exports.underline = underline; | ||
| exports.strikethrough = strikethrough; | ||
| exports.spoiler = spoiler; | ||
| exports.blockquote = blockquote; | ||
| exports.expandableBlockquote = expandableBlockquote; | ||
| exports.inlineURL = inlineURL; | ||
| exports.inlineMention = inlineMention; | ||
| exports.inlineCode = inlineCode; | ||
| exports.codeBlock = codeBlock; | ||
| exports.inlineEmoji = inlineEmoji; | ||
| exports.combine = combine; | ||
| exports.list = list; | ||
| const utils_1 = require("./utils"); | ||
| function bold(text) { | ||
| return `<b>${(0, utils_1.escapeHTML)(text)}</b>`; | ||
| } | ||
| function italic(text) { | ||
| return `<i>${(0, utils_1.escapeHTML)(text)}</i>`; | ||
| } | ||
| function underline(text) { | ||
| return `<u>${(0, utils_1.escapeHTML)(text)}</u>`; | ||
| } | ||
| function strikethrough(text) { | ||
| return `<s>${(0, utils_1.escapeHTML)(text)}</s>`; | ||
| } | ||
| function spoiler(text) { | ||
| return `<span class="tg-spoiler">${(0, utils_1.escapeHTML)(text)}</span>`; | ||
| } | ||
| function blockquote(text) { | ||
| return `<blockquote>${(0, utils_1.escapeHTML)(text)}</blockquote>`; | ||
| } | ||
| function expandableBlockquote(text) { | ||
| return `<blockquote expandable>${(0, utils_1.escapeHTML)(text)}</blockquote>`; | ||
| } | ||
| function inlineURL(text, url) { | ||
| return `<a href="${(0, utils_1.escapeHTML)(url)}">${(0, utils_1.escapeHTML)(text)}</a>`; | ||
| } | ||
| function inlineMention(text, userId) { | ||
| return `<a href="tg://user?id=${userId}">${(0, utils_1.escapeHTML)(text)}</a>`; | ||
| } | ||
| function inlineCode(text) { | ||
| return `<code>${(0, utils_1.escapeHTML)(text)}</code>`; | ||
| } | ||
| function codeBlock(text, language) { | ||
| if (language) { | ||
| return `<pre><code class="language-${(0, utils_1.escapeHTML)(language)}">${(0, utils_1.escapeHTML)(text)}</code></pre>`; | ||
| } | ||
| return `<pre>${(0, utils_1.escapeHTML)(text)}</pre>`; | ||
| } | ||
| function inlineEmoji(emoji, emojiId) { | ||
| return `<tg-emoji emoji-id="${emojiId}">${emoji}</tg-emoji>`; | ||
| } | ||
| function combine(parts, separator = "") { | ||
| return parts.join(separator); | ||
| } | ||
| function list(items, ordered = false) { | ||
| return items | ||
| .map((item, index) => { | ||
| const prefix = ordered ? `${index + 1}. ` : "• "; | ||
| return `${prefix}${item}`; | ||
| }) | ||
| .join("\n"); | ||
| } |
| export * from "./index.js"; |
| import * as htmlFormatters from "./html"; | ||
| import * as markdownv2Formatters from "./markdownv2"; | ||
| import * as markdownFormatters from "./markdown"; | ||
| export declare const html: typeof htmlFormatters; | ||
| export declare const markdown: typeof markdownFormatters; | ||
| export declare const markdownv2: typeof markdownv2Formatters; | ||
| export declare const version = "2.1.0"; | ||
| export * from "./utils"; | ||
| export * from "./parser"; | ||
| declare const _default: { | ||
| html: typeof htmlFormatters; | ||
| markdownv2: typeof markdownv2Formatters; | ||
| markdown: typeof markdownFormatters; | ||
| version: string; | ||
| }; | ||
| export default _default; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.version = exports.markdownv2 = exports.markdown = exports.html = void 0; | ||
| const tslib_1 = require("tslib"); | ||
| const htmlFormatters = tslib_1.__importStar(require("./html")); | ||
| const markdownv2Formatters = tslib_1.__importStar(require("./markdownv2")); | ||
| const markdownFormatters = tslib_1.__importStar(require("./markdown")); | ||
| exports.html = htmlFormatters; | ||
| exports.markdown = markdownFormatters; | ||
| exports.markdownv2 = markdownv2Formatters; | ||
| exports.version = "2.1.0"; | ||
| tslib_1.__exportStar(require("./utils"), exports); | ||
| tslib_1.__exportStar(require("./parser"), exports); | ||
| exports.default = { | ||
| html: exports.html, | ||
| markdownv2: exports.markdownv2, | ||
| markdown: exports.markdown, | ||
| version: exports.version, | ||
| }; |
| export * from "./index.js"; |
| declare function bold(text: string): string; | ||
| declare function italic(text: string): string; | ||
| declare function inlineURL(text: string, url: string): string; | ||
| declare function inlineMention(text: string, userId: number): string; | ||
| declare function inlineCode(text: string): string; | ||
| declare function codeBlock(text: string, language?: string): string; | ||
| declare function combine(parts: string[], separator?: string): string; | ||
| export { bold, italic, inlineURL, inlineMention, inlineCode, codeBlock, combine, }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.bold = bold; | ||
| exports.italic = italic; | ||
| exports.inlineURL = inlineURL; | ||
| exports.inlineMention = inlineMention; | ||
| exports.inlineCode = inlineCode; | ||
| exports.codeBlock = codeBlock; | ||
| exports.combine = combine; | ||
| const utils_1 = require("./utils"); | ||
| function bold(text) { | ||
| return `*${(0, utils_1.escapeMarkdown)(text)}*`; | ||
| } | ||
| function italic(text) { | ||
| return `_${(0, utils_1.escapeMarkdown)(text)}_`; | ||
| } | ||
| function inlineURL(text, url) { | ||
| return `[${(0, utils_1.escapeMarkdown)(text)}](${url})`; | ||
| } | ||
| function inlineMention(text, userId) { | ||
| return `[${(0, utils_1.escapeMarkdown)(text)}](tg://user?id=${userId})`; | ||
| } | ||
| function inlineCode(text) { | ||
| return `\`${text}\``; | ||
| } | ||
| function codeBlock(text, language = "") { | ||
| return `\`\`\`${language}${text}\`\`\``; | ||
| } | ||
| function combine(parts, separator = "") { | ||
| return parts.join(separator); | ||
| } |
| declare function bold(text: string): string; | ||
| declare function italic(text: string): string; | ||
| declare function underline(text: string): string; | ||
| declare function strikethrough(text: string): string; | ||
| declare function spoiler(text: string): string; | ||
| declare function blockquote(text: string): string; | ||
| declare function expandableBlockquote(text: string): string; | ||
| declare function inlineURL(text: string, url: string): string; | ||
| declare function inlineMention(text: string, userId: number): string; | ||
| declare function inlineCode(text: string): string; | ||
| declare function codeBlock(text: string, language?: string): string; | ||
| declare function inlineEmoji(emoji: string, emojiId: string): string; | ||
| declare function combine(parts: string[], separator?: string): string; | ||
| declare function list(items: string[], ordered?: boolean): string; | ||
| export { bold, italic, underline, strikethrough, spoiler, codeBlock, blockquote, expandableBlockquote, inlineURL, inlineMention, inlineCode, inlineEmoji, combine, list, }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.bold = bold; | ||
| exports.italic = italic; | ||
| exports.underline = underline; | ||
| exports.strikethrough = strikethrough; | ||
| exports.spoiler = spoiler; | ||
| exports.codeBlock = codeBlock; | ||
| exports.blockquote = blockquote; | ||
| exports.expandableBlockquote = expandableBlockquote; | ||
| exports.inlineURL = inlineURL; | ||
| exports.inlineMention = inlineMention; | ||
| exports.inlineCode = inlineCode; | ||
| exports.inlineEmoji = inlineEmoji; | ||
| exports.combine = combine; | ||
| exports.list = list; | ||
| const utils_1 = require("./utils"); | ||
| function bold(text) { | ||
| return `*${(0, utils_1.escapeMarkdownV2)(text)}*`; | ||
| } | ||
| function italic(text) { | ||
| return `_${(0, utils_1.escapeMarkdownV2)(text)}_`; | ||
| } | ||
| function underline(text) { | ||
| return `__${(0, utils_1.escapeMarkdownV2)(text)}__`; | ||
| } | ||
| function strikethrough(text) { | ||
| return `~${(0, utils_1.escapeMarkdownV2)(text)}~`; | ||
| } | ||
| function spoiler(text) { | ||
| return `||${(0, utils_1.escapeMarkdownV2)(text)}||`; | ||
| } | ||
| function blockquote(text) { | ||
| return `>${(0, utils_1.escapeMarkdownV2)(text)}`; | ||
| } | ||
| function expandableBlockquote(text) { | ||
| return `**>${(0, utils_1.escapeMarkdownV2)(text)}`; | ||
| } | ||
| function inlineURL(text, url) { | ||
| return `[${(0, utils_1.escapeMarkdownV2)(text)}](${(0, utils_1.escapeMarkdownV2)(url)})`; | ||
| } | ||
| function inlineMention(text, userId) { | ||
| return `[${(0, utils_1.escapeMarkdownV2)(text)}](tg://user?id=${userId})`; | ||
| } | ||
| function inlineCode(text) { | ||
| return `\`${text}\``; | ||
| } | ||
| function codeBlock(text, language) { | ||
| if (language) { | ||
| return `\`\`\`${language}\n${text}\n\`\`\``; | ||
| } | ||
| return `\`\`\`\n${text}\n\`\`\``; | ||
| } | ||
| function inlineEmoji(emoji, emojiId) { | ||
| return ``; | ||
| } | ||
| function combine(parts, separator = "") { | ||
| return parts.join(separator); | ||
| } | ||
| function list(items, ordered = false) { | ||
| return items | ||
| .map((item, index) => { | ||
| const prefix = ordered ? `${index + 1}\\. ` : "• "; | ||
| return `${prefix}${item}`; | ||
| }) | ||
| .join("\n"); | ||
| } |
| import type { MessageEntity, ParseMode } from "@telegram.ts/types"; | ||
| declare function parseEntities(text: string, parseMode: ParseMode): MessageEntity[]; | ||
| declare function calculateOffset(text: string, position: number): number; | ||
| declare function mergeEntities(entities: MessageEntity[]): MessageEntity[]; | ||
| declare function entitiesToFormatted(text: string, entities: MessageEntity[], parseMode?: ParseMode): string; | ||
| export { parseEntities, calculateOffset, mergeEntities, entitiesToFormatted }; |
+290
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseEntities = parseEntities; | ||
| exports.calculateOffset = calculateOffset; | ||
| exports.mergeEntities = mergeEntities; | ||
| exports.entitiesToFormatted = entitiesToFormatted; | ||
| const utils_1 = require("./utils"); | ||
| function parseEntities(text, parseMode) { | ||
| if (parseMode === "HTML") { | ||
| return parseHTMLEntities(text); | ||
| } | ||
| else if (parseMode === "MarkdownV2" || parseMode === "Markdown") { | ||
| return parseMarkdownEntities(text); | ||
| } | ||
| return []; | ||
| } | ||
| function parseHTMLEntities(text) { | ||
| const entities = []; | ||
| const patterns = [ | ||
| { regex: /<b>(.*?)<\/b>/gs, type: "bold" }, | ||
| { regex: /<strong>(.*?)<\/strong>/gs, type: "bold" }, | ||
| { regex: /<i>(.*?)<\/i>/gs, type: "italic" }, | ||
| { regex: /<em>(.*?)<\/em>/gs, type: "italic" }, | ||
| { regex: /<u>(.*?)<\/u>/gs, type: "underline" }, | ||
| { regex: /<s>(.*?)<\/s>/gs, type: "strikethrough" }, | ||
| { regex: /<strike>(.*?)<\/strike>/gs, type: "strikethrough" }, | ||
| { regex: /<del>(.*?)<\/del>/gs, type: "strikethrough" }, | ||
| { | ||
| regex: /<span class="tg-spoiler">(.*?)<\/span>/gs, | ||
| type: "spoiler", | ||
| }, | ||
| { regex: /<tg-spoiler>(.*?)<\/tg-spoiler>/gs, type: "spoiler" }, | ||
| { regex: /<blockquote>(.*?)<\/blockquote>/gs, type: "blockquote" }, | ||
| { | ||
| regex: /<blockquote expandable>(.*?)<\/blockquote>/gs, | ||
| type: "expandable_blockquote", | ||
| }, | ||
| { regex: /<code>(.*?)<\/code>/gs, type: "code" }, | ||
| { | ||
| regex: /<pre><code class="language-(.*?)">(.*?)<\/code><\/pre>/gs, | ||
| type: "pre", | ||
| hasLanguage: true, | ||
| }, | ||
| { regex: /<pre>(.*?)<\/pre>/gs, type: "pre" }, | ||
| { | ||
| regex: /<a href="(.*?)">(.*?)<\/a>/gs, | ||
| type: "text_link", | ||
| hasUrl: true, | ||
| }, | ||
| { | ||
| regex: /<tg-emoji emoji-id="(.*?)">(.*?)<\/tg-emoji>/gs, | ||
| type: "custom_emoji", | ||
| hasEmojiId: true, | ||
| }, | ||
| ]; | ||
| for (const pattern of patterns) { | ||
| const matches = [...text.matchAll(pattern.regex)]; | ||
| for (const match of matches) { | ||
| const matchStart = match.index || 0; | ||
| const offset = calculateOffset(text, matchStart); | ||
| let content; | ||
| let length; | ||
| let entity; | ||
| if (pattern.type === "pre" && pattern.hasLanguage) { | ||
| const language = match[1]; | ||
| const codeContent = match[2]; | ||
| content = codeContent || ""; | ||
| length = (0, utils_1.stripHTML)(content).length; | ||
| entity = { | ||
| type: "pre", | ||
| offset, | ||
| length, | ||
| ...(language && { language }), | ||
| }; | ||
| } | ||
| else if (pattern.type === "text_link" && pattern.hasUrl) { | ||
| const url = match[1]; | ||
| const linkText = match[2]; | ||
| content = linkText || ""; | ||
| length = (0, utils_1.stripHTML)(content).length; | ||
| entity = { | ||
| type: "text_link", | ||
| offset, | ||
| length, | ||
| url: url || "", | ||
| }; | ||
| } | ||
| else if (pattern.type === "custom_emoji" && pattern.hasEmojiId) { | ||
| const emojiId = match[1]; | ||
| const emojiText = match[2]; | ||
| content = emojiText || ""; | ||
| length = (0, utils_1.stripHTML)(content).length; | ||
| entity = { | ||
| type: "custom_emoji", | ||
| offset, | ||
| length, | ||
| custom_emoji_id: emojiId || "", | ||
| }; | ||
| } | ||
| else { | ||
| content = match[1] || ""; | ||
| length = (0, utils_1.stripHTML)(content).length; | ||
| entity = { | ||
| type: pattern.type, | ||
| offset, | ||
| length, | ||
| }; | ||
| } | ||
| entities.push(entity); | ||
| } | ||
| } | ||
| return mergeEntities(entities); | ||
| } | ||
| function parseMarkdownEntities(text) { | ||
| const entities = []; | ||
| const patterns = [ | ||
| { regex: /\*([^*]+)\*/g, type: "bold" }, | ||
| { regex: /_([^_]+)_/g, type: "italic" }, | ||
| { regex: /__([^_]+)__/g, type: "underline" }, | ||
| { regex: /~([^~]+)~/g, type: "strikethrough" }, | ||
| { regex: /\|\|([^|]+)\|\|/g, type: "spoiler" }, | ||
| { regex: /`([^`]+)`/g, type: "code" }, | ||
| { | ||
| regex: /```(\w+)?\n(.*?)\n```/gs, | ||
| type: "pre", | ||
| hasLanguage: true, | ||
| }, | ||
| { | ||
| regex: /\[([^\]]+)\]\(([^)]+)\)/g, | ||
| type: "text_link", | ||
| hasUrl: true, | ||
| }, | ||
| ]; | ||
| for (const pattern of patterns) { | ||
| const matches = [...text.matchAll(pattern.regex)]; | ||
| for (const match of matches) { | ||
| const matchStart = match.index || 0; | ||
| let tempText = text.substring(0, matchStart); | ||
| tempText = tempText.replace(/\*\*([^*]+)\*\*/g, "$1"); | ||
| tempText = tempText.replace(/\*([^*]+)\*/g, "$1"); | ||
| tempText = tempText.replace(/__([^_]+)__/g, "$1"); | ||
| tempText = tempText.replace(/_([^_]+)_/g, "$1"); | ||
| tempText = tempText.replace(/~([^~]+)~/g, "$1"); | ||
| tempText = tempText.replace(/\|\|([^|]+)\|\|/g, "$1"); | ||
| tempText = tempText.replace(/`([^`]+)`/g, "$1"); | ||
| tempText = tempText.replace(/```.*?\n(.*?)\n```/gs, "$1"); | ||
| tempText = tempText.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1"); | ||
| const offset = tempText.length; | ||
| let entity; | ||
| if (pattern.type === "pre" && pattern.hasLanguage) { | ||
| const language = match[1]; | ||
| const codeContent = match[2]; | ||
| entity = { | ||
| type: "pre", | ||
| offset, | ||
| length: (codeContent === null || codeContent === void 0 ? void 0 : codeContent.length) || 0, | ||
| ...(language && { language }), | ||
| }; | ||
| } | ||
| else if (pattern.type === "text_link" && pattern.hasUrl) { | ||
| const linkText = match[1]; | ||
| const url = match[2]; | ||
| entity = { | ||
| type: "text_link", | ||
| offset, | ||
| length: (linkText === null || linkText === void 0 ? void 0 : linkText.length) || 0, | ||
| url: url || "", | ||
| }; | ||
| } | ||
| else { | ||
| const content = match[1]; | ||
| entity = { | ||
| type: pattern.type, | ||
| offset, | ||
| length: (content === null || content === void 0 ? void 0 : content.length) || 0, | ||
| }; | ||
| } | ||
| entities.push(entity); | ||
| } | ||
| } | ||
| return mergeEntities(entities); | ||
| } | ||
| function calculateOffset(text, position) { | ||
| let offset = 0; | ||
| let inTag = false; | ||
| for (let i = 0; i < position && i < text.length; i++) { | ||
| if (text[i] === "<") { | ||
| inTag = true; | ||
| } | ||
| else if (text[i] === ">") { | ||
| inTag = false; | ||
| } | ||
| else if (!inTag) { | ||
| offset++; | ||
| } | ||
| } | ||
| return offset; | ||
| } | ||
| function mergeEntities(entities) { | ||
| const sorted = [...entities].sort((a, b) => a.offset - b.offset); | ||
| const merged = []; | ||
| for (const entity of sorted) { | ||
| const last = merged[merged.length - 1]; | ||
| if (last && last.offset + last.length > entity.offset) { | ||
| continue; | ||
| } | ||
| merged.push(entity); | ||
| } | ||
| return merged; | ||
| } | ||
| function entitiesToFormatted(text, entities, parseMode = "HTML") { | ||
| if (entities.length === 0) | ||
| return text; | ||
| const sorted = [...entities].sort((a, b) => b.offset - a.offset); | ||
| let result = text; | ||
| for (const entity of sorted) { | ||
| const start = entity.offset; | ||
| const end = entity.offset + entity.length; | ||
| const content = text.substring(start, end); | ||
| let formatted = content; | ||
| if (parseMode === "HTML") { | ||
| formatted = formatEntityHTML(entity, content); | ||
| } | ||
| else if (parseMode === "MarkdownV2") { | ||
| formatted = formatEntityMarkdownV2(entity, content); | ||
| } | ||
| result = result.substring(0, start) + formatted + result.substring(end); | ||
| } | ||
| return result; | ||
| } | ||
| function formatEntityHTML(entity, content) { | ||
| var _a; | ||
| switch (entity.type) { | ||
| case "bold": | ||
| return `<b>${content}</b>`; | ||
| case "italic": | ||
| return `<i>${content}</i>`; | ||
| case "underline": | ||
| return `<u>${content}</u>`; | ||
| case "strikethrough": | ||
| return `<s>${content}</s>`; | ||
| case "spoiler": | ||
| return `<span class="tg-spoiler">${content}</span>`; | ||
| case "code": | ||
| return `<code>${content}</code>`; | ||
| case "pre": | ||
| if (entity.language) { | ||
| return `<pre><code class="language-${entity.language}">${content}</code></pre>`; | ||
| } | ||
| return `<pre>${content}</pre>`; | ||
| case "text_link": | ||
| return `<a href="${entity.url}">${content}</a>`; | ||
| case "text_mention": | ||
| return `<a href="tg://user?id=${(_a = entity.user) === null || _a === void 0 ? void 0 : _a.id}">${content}</a>`; | ||
| case "custom_emoji": | ||
| return `<tg-emoji emoji-id="${entity.custom_emoji_id}">${content}</tg-emoji>`; | ||
| default: | ||
| return content; | ||
| } | ||
| } | ||
| function formatEntityMarkdownV2(entity, content) { | ||
| var _a; | ||
| switch (entity.type) { | ||
| case "bold": | ||
| return `*${content}*`; | ||
| case "italic": | ||
| return `_${content}_`; | ||
| case "underline": | ||
| return `__${content}__`; | ||
| case "strikethrough": | ||
| return `~${content}~`; | ||
| case "spoiler": | ||
| return `||${content}||`; | ||
| case "code": | ||
| return `\`${content}\``; | ||
| case "pre": | ||
| if (entity.language) { | ||
| return `\`\`\`${entity.language}\n${content}\n\`\`\``; | ||
| } | ||
| return `\`\`\`\n${content}\n\`\`\``; | ||
| case "text_link": | ||
| return `[${content}](${entity.url})`; | ||
| case "text_mention": | ||
| return `[${content}](tg://user?id=${(_a = entity.user) === null || _a === void 0 ? void 0 : _a.id})`; | ||
| case "custom_emoji": | ||
| return ``; | ||
| default: | ||
| return content; | ||
| } | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); |
| declare function escapeHTML(text: string): string; | ||
| declare function escapeMarkdownV2(text: string): string; | ||
| declare function escapeMarkdown(text: string): string; | ||
| declare function stripHTML(text: string): string; | ||
| declare function getTextLength(text: string, mode?: "HTML" | "MarkdownV2" | "Markdown"): number; | ||
| export { escapeHTML, escapeMarkdown, escapeMarkdownV2, stripHTML, getTextLength, }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.escapeHTML = escapeHTML; | ||
| exports.escapeMarkdown = escapeMarkdown; | ||
| exports.escapeMarkdownV2 = escapeMarkdownV2; | ||
| exports.stripHTML = stripHTML; | ||
| exports.getTextLength = getTextLength; | ||
| function escapeHTML(text) { | ||
| return text | ||
| .replace(/&/g, "&") | ||
| .replace(/</g, "<") | ||
| .replace(/>/g, ">") | ||
| .replace(/"/g, """); | ||
| } | ||
| function escapeMarkdownV2(text) { | ||
| const specialChars = /([_*\[\]()~`>#+\-=|{}.!\\])/g; | ||
| return text.replace(specialChars, "\\$1"); | ||
| } | ||
| function escapeMarkdown(text) { | ||
| const specialChars = /([_*\[`])/g; | ||
| return text.replace(specialChars, "\\$1"); | ||
| } | ||
| function stripHTML(text) { | ||
| return text.replace(/<[^>]*>/g, ""); | ||
| } | ||
| function getTextLength(text, mode = "HTML") { | ||
| if (mode === "HTML") { | ||
| return stripHTML(text).length; | ||
| } | ||
| return text.length; | ||
| } |
+18
-4
@@ -1,7 +0,21 @@ | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including, without limitation, the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
| MIT License | ||
| 1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
| Copyright (c) 2024 TelegramsJS | ||
| 2. THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| By exercising the rights granted herein, you agree to the terms and conditions of this License. | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
+17
-10
| { | ||
| "name": "@telegram.ts/formatters", | ||
| "version": "2.0.1", | ||
| "description": "Sub-library for formatting Telegram messages", | ||
| "main": "./dist/src/index.js", | ||
| "version": "2.1.0", | ||
| "description": "Powerful text formatting library for Telegram Bot API with HTML and MarkdownV2 support", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "require": { | ||
| "types": "./dist/src/index.d.ts", | ||
| "default": "./dist/src/index.js" | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, | ||
| "import": { | ||
| "types": "./dist/src/index.d.mts", | ||
| "default": "./dist/src/index.mjs" | ||
| "types": "./dist/index.d.mts", | ||
| "default": "./dist/index.mjs" | ||
| } | ||
@@ -34,3 +35,5 @@ } | ||
| "library", | ||
| "sempai-07" | ||
| "sempai-07", | ||
| "telegramsjs", | ||
| "bot" | ||
| ], | ||
@@ -40,5 +43,9 @@ "homepage": "https://telegramsjs.vercel.app/", | ||
| "devDependencies": { | ||
| "@telegram.ts/types": "^1.15.1", | ||
| "@types/node": "^22.1.0" | ||
| "@telegram.ts/types": "^1.24.0", | ||
| "@types/node": "^25.0.2", | ||
| "typescript": "^5.9.3" | ||
| }, | ||
| "dependencies": { | ||
| "tslib": "^2.8.1" | ||
| } | ||
| } |
+426
-38
| # @telegram.ts/formatters | ||
| [](https://www.npmjs.com/package/@telegram.ts/formatters) | ||
| [](https://core.telegram.org/bots/api) | ||
| [](https://www.npmjs.com/package/@telegram.ts/formatters) | ||
| [](https://core.telegram.org/bots/api) | ||
| [](https://github.com/telegramsjs/formatters/blob/main/LICENSE) | ||
| [](https://www.typescriptlang.org/) | ||
| `@telegram.ts/formatters` is a TypeScript library that provides functions for formatting messages according to the Telegram API's formatting rules. It offers a set of functions for applying various text formatting styles. | ||
| **Powerful and type-safe text formatting library for Telegram Bot API with full HTML and MarkdownV2 support.** | ||
| ## Features | ||
| ## ✨ Features | ||
| - **Text Formatting:** Apply bold, italic, underline, strikethrough, and spoiler formatting to text. | ||
| - **Inline URLs and Mentions:** Create clickable inline URLs and user mentions within messages. | ||
| - **Emoji Support:** Embed emojis into messages for expressive communication. | ||
| - **Code Blocks:** Format text as inline or pre-formatted code blocks with syntax highlighting support. | ||
| - 🎨 **Multiple Format Support** - HTML, MarkdownV2, and legacy Markdown | ||
| - 🔒 **Type-Safe** - Full TypeScript support with comprehensive type definitions | ||
| - 🛡️ **Auto-Escaping** - Automatic escaping of special characters | ||
| - 🎯 **Simple API** - Intuitive and easy-to-use formatting functions | ||
| - 📦 **Zero Dependencies** - Lightweight with no external dependencies | ||
| - 🔧 **Flexible** - Works with any Telegram bot library | ||
| - ⚡ **Fast** - Optimized for performance | ||
| - 📚 **Well-Documented** - Extensive documentation and examples | ||
| ## Installation | ||
| ## 📦 Installation | ||
| You can install `@telegram.ts/formatters` via npm or yarn: | ||
| ```bash | ||
| npm install @telegram.ts/formatters | ||
| ``` | ||
| ```bash | ||
| npm install @telegram.ts/formatters | ||
| # or | ||
| yarn add @telegram.ts/formatters | ||
| ``` | ||
| ## Usage | ||
| ```bash | ||
| pnpm add @telegram.ts/formatters | ||
| ``` | ||
| ## 🚀 Quick Start | ||
| ```typescript | ||
| import { html, markdownv2 } from "@telegram.ts/formatters"; | ||
| // HTML formatting | ||
| const htmlText = | ||
| html.bold("Bold text") + | ||
| "\n" + | ||
| html.italic("Italic text") + | ||
| "\n" + | ||
| html.underline("Underlined text") + | ||
| "\n" + | ||
| html.inlineURL("Click here", "https://example.com"); | ||
| // MarkdownV2 formatting | ||
| const markdownText = | ||
| markdownv2.bold("Bold text") + | ||
| "\n" + | ||
| markdownv2.italic("Italic text") + | ||
| "\n" + | ||
| markdownv2.strikethrough("Strikethrough text"); | ||
| // Send with your bot library | ||
| await bot.sendMessage(chatId, htmlText, { parse_mode: "HTML" }); | ||
| await bot.sendMessage(chatId, markdownText, { parse_mode: "MarkdownV2" }); | ||
| ``` | ||
| ## 📖 Usage | ||
| ### HTML Formatting | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| // Basic formatting | ||
| html.bold("Bold text"); // <b>Bold text</b> | ||
| html.italic("Italic text"); // <i>Italic text</i> | ||
| html.underline("Underlined"); // <u>Underlined</u> | ||
| html.strikethrough("Strikethrough"); // <s>Strikethrough</s> | ||
| html.spoiler("Spoiler text"); // <span class="tg-spoiler">Spoiler text</span> | ||
| // Links and mentions | ||
| html.inlineURL("Google", "https://google.com"); | ||
| // <a href="https://google.com">Google</a> | ||
| html.inlineMention("John", 123456789); | ||
| // <a href="tg://user?id=123456789">John</a> | ||
| // Code | ||
| html.inlineCode("const x = 1"); | ||
| // <code>const x = 1</code> | ||
| html.codeBlock("const x = 1;\nconsole.log(x);", "javascript"); | ||
| // <pre><code class="language-javascript">const x = 1; | ||
| // console.log(x);</code></pre> | ||
| // Quotes | ||
| html.blockquote("This is a quote"); | ||
| // <blockquote>This is a quote</blockquote> | ||
| html.expandableBlockquote("Long quote..."); | ||
| // <blockquote expandable>Long quote...</blockquote> | ||
| // Custom emoji | ||
| html.inlineEmoji("👍", "5368324170671202286"); | ||
| // <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji> | ||
| ``` | ||
| ### MarkdownV2 Formatting | ||
| ````typescript | ||
| import { markdownv2 } from "@telegram.ts/formatters"; | ||
| // Basic formatting | ||
| markdownv2.bold("Bold text"); // *Bold text* | ||
| markdownv2.italic("Italic text"); // _Italic text_ | ||
| markdownv2.underline("Underlined"); // __Underlined__ | ||
| markdownv2.strikethrough("Strike"); // ~Strike~ | ||
| markdownv2.spoiler("Spoiler"); // ||Spoiler|| | ||
| // Links and mentions | ||
| markdownv2.inlineURL("Google", "https://google.com"); | ||
| // [Google](https://google.com) | ||
| markdownv2.inlineMention("John", 123456789); | ||
| // [John](tg://user?id=123456789) | ||
| // Code | ||
| markdownv2.inlineCode("const x = 1"); | ||
| // `const x = 1` | ||
| markdownv2.codeBlock("const x = 1;", "javascript"); | ||
| // ```javascript | ||
| // const x = 1; | ||
| // ``` | ||
| // Quotes | ||
| markdownv2.blockquote("Quote"); // >Quote | ||
| markdownv2.expandableBlockquote("Long"); // **>Long | ||
| // Custom emoji | ||
| markdownv2.inlineEmoji("👍", "5368324170671202286"); | ||
| //  | ||
| ```` | ||
| ### Combining Formats | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| // Combine multiple formats | ||
| const text = html.combine([html.bold("Hello"), html.italic("World")], " "); | ||
| // <b>Hello</b> <i>World</i> | ||
| // Create lists | ||
| const list = html.list(["First item", "Second item", "Third item"], true); // true for ordered list | ||
| // 1. First item | ||
| // 2. Second item | ||
| // 3. Third item | ||
| ``` | ||
| ### Working with Entities | ||
| ```typescript | ||
| import { parseEntities, entitiesToFormatted } from "@telegram.ts/formatters"; | ||
| // Parse formatted text to entities | ||
| const text = html.bold("Hello") + " " + html.italic("World"); | ||
| const entities = parseEntities(text, "HTML"); | ||
| // Convert entities back to formatted text | ||
| const formattedText = entitiesToFormatted("Hello World", entities, "HTML"); | ||
| ``` | ||
| ### Utilities | ||
| ```typescript | ||
| import { | ||
| html: { | ||
| bold, | ||
| italic, | ||
| underline, | ||
| strikethrough, | ||
| spoiler, | ||
| inlineURL, | ||
| inlineMention, | ||
| inlineEmoji, | ||
| inlineCode, | ||
| codeBlock, | ||
| }, | ||
| parseEntities, | ||
| } from '@telegram.ts/formatters'; | ||
| escapeHTML, | ||
| escapeMarkdownV2, | ||
| stripHTML, | ||
| getTextLength, | ||
| } from "@telegram.ts/formatters"; | ||
| // Apply text formatting | ||
| const formattedText = bold('bold text') + '\n' + | ||
| italic('italic text') + '\n' + | ||
| underline('underline') + '\n' + | ||
| strikethrough('strikethrough') + '\n' + | ||
| spoiler('spoiler'); | ||
| // Escape special characters | ||
| escapeHTML("<script>alert('XSS')</script>"); | ||
| // <script>alert('XSS')</script> | ||
| console.log(formattedText, parseEntities(formattedText, "HTML")); | ||
| escapeMarkdownV2("Text with *special* chars"); | ||
| // Text with \\*special\\* chars | ||
| // Strip HTML tags | ||
| stripHTML("<b>Bold</b> text"); | ||
| // Bold text | ||
| // Get text length without formatting | ||
| getTextLength("<b>Hello</b>", "HTML"); | ||
| // 5 | ||
| ``` | ||
| ## License | ||
| ## 🎯 Real-World Examples | ||
| This project is licensed under the MIT License - see the [LICENSE](https://github.com/telegramsjs/formatters/blob/main/LICENSE) file for details. | ||
| ### Profile Card | ||
| ## Contributing | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| Contributions are welcome! If you find any issues or have suggestions for improvements, please create a `GitHub` issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my username `@SempaiJS` or on Discord using my username `sempaika_chess`. | ||
| function createProfile(user: User) { | ||
| return html.combine( | ||
| [ | ||
| html.bold("👤 USER PROFILE"), | ||
| html.strikethrough("━━━━━━━━━━━━━━━━"), | ||
| "", | ||
| html.bold("Name: ") + html.italic(user.firstName), | ||
| html.bold("ID: ") + html.inlineCode(user.id.toString()), | ||
| html.bold("Username: ") + | ||
| (user.username ? `@${user.username}` : html.italic("not set")), | ||
| html.bold("Status: ") + html.underline("Active"), | ||
| ], | ||
| "\n", | ||
| ); | ||
| } | ||
| ``` | ||
| ### Menu with Buttons | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| function createMenu() { | ||
| return html.combine( | ||
| [ | ||
| html.bold("🎮 MAIN MENU"), | ||
| html.strikethrough("━━━━━━━━━━━━━"), | ||
| "", | ||
| html.bold("1. ") + html.underline("Profile") + " 👤", | ||
| html.bold("2. ") + html.underline("Settings") + " ⚙️", | ||
| html.bold("3. ") + html.underline("Help") + " ❓", | ||
| "", | ||
| html.italic("Choose an option"), | ||
| ], | ||
| "\n", | ||
| ); | ||
| } | ||
| ``` | ||
| ### Code Example | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| const code = ` | ||
| import { TelegramClient } from "telegramsjs"; | ||
| const client = new TelegramClient("TOKEN"); | ||
| client.on("ready", () => { | ||
| console.log("Bot is ready!"); | ||
| }); | ||
| client.login(); | ||
| `; | ||
| const message = html.combine( | ||
| [ | ||
| html.bold("📝 Example Code"), | ||
| "", | ||
| html.codeBlock(code.trim(), "typescript"), | ||
| "", | ||
| html.italic("Copy and paste to get started!"), | ||
| ], | ||
| "\n", | ||
| ); | ||
| ``` | ||
| ### Progress Bar | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| function createProgress(percentage: number) { | ||
| const filled = Math.floor(percentage / 10); | ||
| const empty = 10 - filled; | ||
| const bar = "█".repeat(filled) + "░".repeat(empty); | ||
| return html.combine( | ||
| [ | ||
| html.bold("📊 Download Progress"), | ||
| "", | ||
| html.inlineCode(bar) + " " + html.bold(`${percentage}%`), | ||
| "", | ||
| html.italic("Status: ") + html.underline("In progress..."), | ||
| ], | ||
| "\n", | ||
| ); | ||
| } | ||
| ``` | ||
| ### Error Message | ||
| ```typescript | ||
| import { html } from "@telegram.ts/formatters"; | ||
| function createError(error: Error) { | ||
| return html.combine( | ||
| [ | ||
| html.bold("❌ ERROR"), | ||
| html.strikethrough("━━━━━━━━━━"), | ||
| "", | ||
| html.italic("An error occurred:"), | ||
| "", | ||
| html.codeBlock(error.message, "text"), | ||
| "", | ||
| html.underline("Please try again later"), | ||
| ], | ||
| "\n", | ||
| ); | ||
| } | ||
| ``` | ||
| ## 📚 API Reference | ||
| ### HTML Formatter | ||
| | Function | Description | Example | | ||
| | ----------------------------- | ------------------ | ------------------------------------------ | | ||
| | `bold(text)` | Bold text | `<b>text</b>` | | ||
| | `italic(text)` | Italic text | `<i>text</i>` | | ||
| | `underline(text)` | Underlined text | `<u>text</u>` | | ||
| | `strikethrough(text)` | Strikethrough text | `<s>text</s>` | | ||
| | `spoiler(text)` | Spoiler text | `<span class="tg-spoiler">text</span>` | | ||
| | `blockquote(text)` | Block quote | `<blockquote>text</blockquote>` | | ||
| | `expandableBlockquote(text)` | Expandable quote | `<blockquote expandable>text</blockquote>` | | ||
| | `inlineURL(text, url)` | Inline link | `<a href="url">text</a>` | | ||
| | `inlineMention(text, userId)` | User mention | `<a href="tg://user?id=123">text</a>` | | ||
| | `inlineCode(text)` | Inline code | `<code>text</code>` | | ||
| | `codeBlock(text, lang?)` | Code block | `<pre><code>text</code></pre>` | | ||
| | `inlineEmoji(emoji, id)` | Custom emoji | `<tg-emoji emoji-id="id">emoji</tg-emoji>` | | ||
| | `combine(parts, sep?)` | Combine strings | Joins array with separator | | ||
| | `list(items, ordered?)` | Create list | Formats array as list | | ||
| ### MarkdownV2 Formatter | ||
| | Function | Description | Example | | ||
| | ----------------------------- | ------------------ | ---------------------------- | | ||
| | `bold(text)` | Bold text | `*text*` | | ||
| | `italic(text)` | Italic text | `_text_` | | ||
| | `underline(text)` | Underlined text | `__text__` | | ||
| | `strikethrough(text)` | Strikethrough text | `~text~` | | ||
| | `spoiler(text)` | Spoiler text | `\|\|text\|\|` | | ||
| | `blockquote(text)` | Block quote | `>text` | | ||
| | `expandableBlockquote(text)` | Expandable quote | `**>text` | | ||
| | `inlineURL(text, url)` | Inline link | `[text](url)` | | ||
| | `inlineMention(text, userId)` | User mention | `[text](tg://user?id=123)` | | ||
| | `inlineCode(text)` | Inline code | `` `text` `` | | ||
| | `codeBlock(text, lang?)` | Code block | ` ```lang\ntext\n``` ` | | ||
| | `inlineEmoji(emoji, id)` | Custom emoji | `` | | ||
| ### Utilities | ||
| | Function | Description | | ||
| | --------------------------- | ------------------------------------ | | ||
| | `escapeHTML(text)` | Escape HTML special characters | | ||
| | `escapeMarkdownV2(text)` | Escape MarkdownV2 special characters | | ||
| | `escapeMarkdown(text)` | Escape Markdown special characters | | ||
| | `stripHTML(text)` | Remove HTML tags from text | | ||
| | `getTextLength(text, mode)` | Get text length without formatting | | ||
| ### Parser Functions | ||
| | Function | Description | | ||
| | ------------------------------------------- | ---------------------------------- | | ||
| | `parseEntities(text, mode)` | Parse formatted text to entities | | ||
| | `entitiesToFormatted(text, entities, mode)` | Convert entities to formatted text | | ||
| | `calculateOffset(text, position)` | Calculate offset in plain text | | ||
| | `mergeEntities(entities)` | Merge overlapping entities | | ||
| ## 🔧 Integration Examples | ||
| ### With TelegramsJS | ||
| ```typescript | ||
| import { TelegramClient } from "telegramsjs"; | ||
| import { html } from "@telegram.ts/formatters"; | ||
| const client = new TelegramClient("YOUR_BOT_TOKEN"); | ||
| client.on("message", async (message) => { | ||
| if (message.content === "/start") { | ||
| const text = html.combine( | ||
| [ | ||
| html.bold("Welcome!"), | ||
| html.italic("I'm a bot with beautiful formatting"), | ||
| ], | ||
| "\n", | ||
| ); | ||
| await message.reply(text, { parse_mode: "HTML" }); | ||
| } | ||
| }); | ||
| client.login(); | ||
| ``` | ||
| ### With node-telegram-bot-api | ||
| ```typescript | ||
| import TelegramBot from "node-telegram-bot-api"; | ||
| import { html } from "@telegram.ts/formatters"; | ||
| const bot = new TelegramBot("YOUR_BOT_TOKEN", { polling: true }); | ||
| bot.onText(/\/start/, (msg) => { | ||
| const text = html.bold("Hello!") + "\n" + html.italic("Welcome to the bot"); | ||
| bot.sendMessage(msg.chat.id, text, { parse_mode: "HTML" }); | ||
| }); | ||
| ``` | ||
| ### With Telegraf | ||
| ```typescript | ||
| import { Telegraf } from "telegraf"; | ||
| import { html } from "@telegram.ts/formatters"; | ||
| const bot = new Telegraf("YOUR_BOT_TOKEN"); | ||
| bot.start((ctx) => { | ||
| const text = html.bold("Hello!") + "\n" + html.italic("Welcome!"); | ||
| ctx.reply(text, { parse_mode: "HTML" }); | ||
| }); | ||
| bot.launch(); | ||
| ``` | ||
| ## 🎓 Best Practices | ||
| 1. **Choose the right format**: HTML is recommended for most cases as it's easier to work with | ||
| 2. **Use auto-escaping**: The library automatically escapes special characters, so you don't need to worry about it | ||
| 3. **Combine wisely**: Use `combine()` for cleaner code when joining multiple formatted strings | ||
| 4. **Cache formatted text**: For frequently used messages, cache the formatted text to improve performance | ||
| 5. **Test with Telegram**: Always test your formatted messages in Telegram to ensure they render correctly | ||
| ## 🤝 Contributing | ||
| Contributions are welcome! Please feel free to submit a Pull Request. | ||
| ## 🔗 Links | ||
| - [NPM Package](https://www.npmjs.com/package/@telegram.ts/formatters) | ||
| - [GitHub Repository](https://github.com/telegramsjs/formatters) | ||
| - [Telegram Bot API](https://core.telegram.org/bots/api) | ||
| - [TelegramsJS Documentation](https://telegramsjs.vercel.app/) |
| { | ||
| "name": "@telegram.ts/formatters", | ||
| "version": "2.0.1", | ||
| "description": "Sub-library for formatting Telegram messages", | ||
| "main": "./dist/src/index.js", | ||
| "exports": { | ||
| ".": { | ||
| "require": { | ||
| "types": "./dist/src/index.d.ts", | ||
| "default": "./dist/src/index.js" | ||
| }, | ||
| "import": { | ||
| "types": "./dist/src/index.d.mts", | ||
| "default": "./dist/src/index.mjs" | ||
| } | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "files": [ | ||
| "./dist", | ||
| "package.json", | ||
| "README.md", | ||
| "LICENSE" | ||
| ], | ||
| "keywords": [ | ||
| "javascript", | ||
| "typescript", | ||
| "formatters", | ||
| "html", | ||
| "markdownv", | ||
| "library", | ||
| "sempai-07" | ||
| ], | ||
| "homepage": "https://telegramsjs.vercel.app/", | ||
| "author": "Sempai<zadmanthegreat@gmail.com>", | ||
| "devDependencies": { | ||
| "@telegram.ts/types": "^1.15.1", | ||
| "@types/node": "^22.1.0" | ||
| } | ||
| } |
| type TypeSupportedLanguages = "markup" | "html" | "xml" | "svg" | "mathml" | "ssml" | "atom" | "rss" | "css" | "clike" | "regex" | "javascript" | "js" | "abap" | "abnf" | "actionscript" | "ada" | "agda" | "al" | "antlr4" | "g4" | "apacheconf" | "sql" | "apex" | "apl" | "applescript" | "aql" | "c" | "cpp" | "arduino" | "ino" | "arff" | "armasm" | "arm-asm" | "bash" | "sh" | "shell" | "yaml" | "yml" | "markdown" | "md" | "arturo" | "art" | "asciidoc" | "adoc" | "csharp" | "cs" | "dotnet" | "aspnet" | "asm6502" | "asmatmel" | "autohotkey" | "autoit" | "avisynth" | "avs" | "avro-idl" | "avdl" | "awk" | "gawk" | "basic" | "batch" | "bbcode" | "shortcode" | "bbj" | "bicep" | "birb" | "bison" | "bnf" | "rbnf" | "bqn" | "brainfuck" | "brightscript" | "bro" | "cfscript" | "cfc" | "chaiscript" | "cil" | "cilkc" | "cilk-c" | "cilkcpp" | "cilk" | "clojure" | "cmake" | "cobol" | "coffeescript" | "coffee" | "concurnas" | "conc" | "csp" | "cooklang" | "ruby" | "rb" | "crystal" | "csv" | "cue" | "cypher" | "d" | "dart" | "dataweave" | "dax" | "dhall" | "diff" | "markup-templating" | "django" | "jinja2" | "dns-zone-file" | "dns-zone" | "docker" | "dockerfile" | "dot" | "gv" | "ebnf" | "editorconfig" | "eiffel" | "ejs" | "eta" | "elixir" | "elm" | "lua" | "etlua" | "erb" | "erlang" | "excel-formula" | "xlsx" | "xls" | "fsharp" | "factor" | "false" | "firestore-security-rules" | "flow" | "fortran" | "ftl" | "gml" | "gamemakerlanguage" | "gap" | "gcode" | "gdscript" | "gedcom" | "gettext" | "po" | "git" | "glsl" | "gn" | "gni" | "linker-script" | "ld" | "go" | "go-module" | "go-mod" | "graphql" | "groovy" | "less" | "scss" | "textile" | "haml" | "handlebars" | "hbs" | "mustache" | "haskell" | "hs" | "haxe" | "hcl" | "hlsl" | "hoon" | "hpkp" | "hsts" | "json" | "webmanifest" | "uri" | "url" | "http" | "ichigojam" | "icon" | "icu-message-format" | "idris" | "idr" | "ignore" | "gitignore" | "hgignore" | "npmignore" | "inform7" | "ini" | "io" | "j" | "java" | "scala" | "php" | "javadoclike" | "javadoc" | "javastacktrace" | "jolie" | "jq" | "typescript" | "n4js" | "n4jsd" | "json5" | "jsonp" | "jsstacktrace" | "julia" | "keepalived" | "keyman" | "kotlin" | "kt" | "kts" | "kusto" | "latex" | "tex" | "context" | "latte" | "scheme" | "lilypond" | "ly" | "liquid" | "lisp" | "emacs" | "elisp" | "emacs-lisp" | "livescript" | "llvm" | "log" | "lolcode" | "magma" | "makefile" | "mata" | "matlab" | "maxscript" | "mel" | "mermaid" | "metafont" | "mizar" | "mongodb" | "monkey" | "moonscript" | "moon" | "n1ql" | "nand2tetris-hdl" | "nand2tetris" | "neon" | "nevod" | "nginx" | "nim" | "nix" | "nsis" | "nsl" | "nsm" | "nso" | "nsp" | "nsr" | "nss" | "nsv" | "nsw" | "nt" | "nta" | "ntb" | "ntc" | "ntd" | "nte" | "ntf" | "ntg" | "nth" | "nti" | "ntp" | "ntq" | "ntr" | "nts" | "ntt" | "ntx" | "nty" | "ntz" | "nu" | "nup" | "nus" | "nv" | "nve" | "nvf" | "nvl" | "nvm" | "nvo" | "nvp" | "nvq" | "nvr" | "nvs" | "nvt" | "nvv" | "nvx" | "nvy" | "nw" | "nwb" | "nwv" | "nxc" | "nxl" | "nxq" | "nxr" | "nxs" | "nxt" | "ny" | "nym" | "nys" | "nyy" | "nz" | "o" | "oak" | "objc" | "objectpascal" | "ocaml" | "odin" | "opencl" | "openqasm" | "qasm" | "oz" | "parigp" | "parser" | "pascal" | "asp" | "pascaligo" | "psl" | "pcaxis" | "px" | "peoplecode" | "pcode" | "perl" | "perl6" | "phpdoc" | "plant-uml" | "plantuml" | "plsql" | "powerquery" | "pq" | "mscript" | "powershell" | "processing" | "prolog" | "promql" | "properties" | "proto" | "protobuf" | "stylus" | "swift" | "systemd" | "t4-templating" | "t4" | "t4-cs" | "vb" | "t4-vb" | "tap" | "tcl" | "tt2" | "toml" | "tremor" | "trickle" | "troy" | "typo" | "typoscript" | "uc" | "unrealscript" | "uc" | "uscript" | "uc" | "unrealscript" | "uc" | "uc" | "uc" | "uscript" | "uc" | "uorazor" | "v" | "vala" | "velocity" | "verilog" | "vhdl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "vim" | "visual-basic" | "vb" | "vba" | "vbs" | "vbnet" | "vbscript" | "vcl" | "w" | "warpscript" | "wasm" | "web-idl" | "webidl" | "wgsl" | "wiki" | "wolfram" | "wl" | "wolfram" | "mathematica" | "nb" | "wl" | "wolfram" | "mathematica" | "nb" | "wl" | "wolfram" | "mathematica" | "nb" | "wl" | "wolfram" | "mathematica" | "nb" | "wl" | "wolfram" | "mathematica" | "nb" | "wren" | "xeora" | "xeoracube" | "xquery" | "yang" | "zig"; | ||
| declare const SupportedLanguages: { | ||
| Markup: string[]; | ||
| CSS: string[]; | ||
| C_like: string[]; | ||
| Regex: string[]; | ||
| JavaScript: string[]; | ||
| ABAP: string[]; | ||
| ABNF: string[]; | ||
| ActionScript: string[]; | ||
| Ada: string[]; | ||
| Agda: string[]; | ||
| AL: string[]; | ||
| ANTLR4: string[]; | ||
| "Apache Configuration": string[]; | ||
| SQL: string[]; | ||
| Apex: string[]; | ||
| APL: string[]; | ||
| AppleScript: string[]; | ||
| AQL: string[]; | ||
| C: string[]; | ||
| "C++": string[]; | ||
| Arduino: string[]; | ||
| ARFF: string[]; | ||
| "ARM Assembly": string[]; | ||
| Bash: string[]; | ||
| YAML: string[]; | ||
| Markdown: string[]; | ||
| Arturo: string[]; | ||
| AsciiDoc: string[]; | ||
| "C#": string[]; | ||
| "ASP.NET (C#)": string[]; | ||
| "6502 Assembly": string[]; | ||
| "Atmel AVR Assembly": string[]; | ||
| AutoHotkey: string[]; | ||
| AutoIt: string[]; | ||
| AviSynth: string[]; | ||
| "Avro IDL": string[]; | ||
| AWK: string[]; | ||
| BASIC: string[]; | ||
| Batch: string[]; | ||
| BBcode: string[]; | ||
| BBj: string[]; | ||
| Bicep: string[]; | ||
| Birb: string[]; | ||
| Bison: string[]; | ||
| BNF: string[]; | ||
| BQN: string[]; | ||
| Brainfuck: string[]; | ||
| BrightScript: string[]; | ||
| Bro: string[]; | ||
| CFScript: string[]; | ||
| ChaiScript: string[]; | ||
| CIL: string[]; | ||
| "Cilk/C": string[]; | ||
| "Cilk/C++": string[]; | ||
| Clojure: string[]; | ||
| CMake: string[]; | ||
| COBOL: string[]; | ||
| CoffeeScript: string[]; | ||
| Concurnas: string[]; | ||
| "Content-Security-Policy": string[]; | ||
| Cooklang: string[]; | ||
| Ruby: string[]; | ||
| Crystal: string[]; | ||
| CSV: string[]; | ||
| CUE: string[]; | ||
| Cypher: string[]; | ||
| D: string[]; | ||
| Dart: string[]; | ||
| DataWeave: string[]; | ||
| DAX: string[]; | ||
| Dhall: string[]; | ||
| Diff: string[]; | ||
| "Markup templating": string[]; | ||
| "Django/Jinja2": string[]; | ||
| "DNS zone file": string[]; | ||
| Docker: string[]; | ||
| "DOT (Graphviz)": string[]; | ||
| EBNF: string[]; | ||
| EditorConfig: string[]; | ||
| Eiffel: string[]; | ||
| EJS: string[]; | ||
| Elixir: string[]; | ||
| Elm: string[]; | ||
| Lua: string[]; | ||
| "Embedded Lua templating": string[]; | ||
| ERB: string[]; | ||
| Erlang: string[]; | ||
| "Excel Formula": string[]; | ||
| "F#": string[]; | ||
| Factor: string[]; | ||
| False: string[]; | ||
| "Firestore security rules": string[]; | ||
| Flow: string[]; | ||
| Fortran: string[]; | ||
| "FreeMarker Template Language": string[]; | ||
| "GameMaker Language": string[]; | ||
| "GAP (CAS)": string[]; | ||
| "G-code": string[]; | ||
| GDScript: string[]; | ||
| GEDCOM: string[]; | ||
| gettext: string[]; | ||
| Git: string[]; | ||
| GLSL: string[]; | ||
| GN: string[]; | ||
| "GNU Linker Script": string[]; | ||
| Go: string[]; | ||
| "Go module": string[]; | ||
| GraphQL: string[]; | ||
| Groovy: string[]; | ||
| Less: string[]; | ||
| "Sass (SCSS)": string[]; | ||
| Textile: string[]; | ||
| Haml: string[]; | ||
| Handlebars: string[]; | ||
| Haskell: string[]; | ||
| Haxe: string[]; | ||
| HCL: string[]; | ||
| HLSL: string[]; | ||
| Hoon: string[]; | ||
| "HTTP Public-Key-Pins": string[]; | ||
| "HTTP Strict-Transport-Security": string[]; | ||
| JSON: string[]; | ||
| URI: string[]; | ||
| HTTP: string[]; | ||
| IchigoJam: string[]; | ||
| Icon: string[]; | ||
| "ICU Message Format": string[]; | ||
| Idris: string[]; | ||
| ignore: string[]; | ||
| "Inform 7": string[]; | ||
| Ini: string[]; | ||
| Io: string[]; | ||
| J: string[]; | ||
| Java: string[]; | ||
| Scala: string[]; | ||
| PHP: string[]; | ||
| "JavaDoc-like": string[]; | ||
| JavaDoc: string[]; | ||
| "Java stack trace": string[]; | ||
| Jolie: string[]; | ||
| JQ: string[]; | ||
| TypeScript: string[]; | ||
| JSDoc: string[]; | ||
| N4JS: string[]; | ||
| JSON5: string[]; | ||
| JSONP: string[]; | ||
| "JS stack trace": string[]; | ||
| Julia: string[]; | ||
| Keepalived: string[]; | ||
| Keyman: string[]; | ||
| Kotlin: string[]; | ||
| Kusto: string[]; | ||
| LaTeX: string[]; | ||
| Latte: string[]; | ||
| Scheme: string[]; | ||
| LilyPond: string[]; | ||
| Liquid: string[]; | ||
| Lisp: string[]; | ||
| LiveScript: string[]; | ||
| "LLVM IR": string[]; | ||
| "Log file": string[]; | ||
| LOLCODE: string[]; | ||
| "Magma (CAS)": string[]; | ||
| Makefile: string[]; | ||
| Mata: string[]; | ||
| MATLAB: string[]; | ||
| MAXScript: string[]; | ||
| MEL: string[]; | ||
| Mermaid: string[]; | ||
| METAFONT: string[]; | ||
| Mizar: string[]; | ||
| MongoDB: string[]; | ||
| Monkey: string[]; | ||
| MoonScript: string[]; | ||
| N1QL: string[]; | ||
| "Nand To Tetris HDL": string[]; | ||
| Naninovel: string[]; | ||
| NASM: string[]; | ||
| NEON: string[]; | ||
| Nevod: string[]; | ||
| nginx: string[]; | ||
| Nim: string[]; | ||
| Nix: string[]; | ||
| NSIS: string[]; | ||
| ObjectiveC: string[]; | ||
| OCaml: string[]; | ||
| Odin: string[]; | ||
| OpenCL: string[]; | ||
| OpenQasm: string[]; | ||
| Oz: string[]; | ||
| "PARI/GP": string[]; | ||
| Parser: string[]; | ||
| Pascal: string[]; | ||
| Pascaligo: string[]; | ||
| "PATROL Scripting Language": string[]; | ||
| "PC-Axis": string[]; | ||
| PeopleCode: string[]; | ||
| Perl: string[]; | ||
| PHPDoc: string[]; | ||
| PlantUML: string[]; | ||
| "PL/SQL": string[]; | ||
| PowerQuery: string[]; | ||
| PowerShell: string[]; | ||
| Processing: string[]; | ||
| Prolog: string[]; | ||
| PromQL: string[]; | ||
| properties: string[]; | ||
| "Protocol Buffers": string[]; | ||
| Stylus: string[]; | ||
| Twig: string[]; | ||
| Pug: string[]; | ||
| Puppet: string[]; | ||
| PureBasic: string[]; | ||
| Python: string[]; | ||
| Q: string[]; | ||
| QML: string[]; | ||
| Qore: string[]; | ||
| R: string[]; | ||
| Racket: string[]; | ||
| "Razor C#": string[]; | ||
| "React JSX": string[]; | ||
| "React TSX": string[]; | ||
| Reason: string[]; | ||
| Rego: string[]; | ||
| "Ren'py": string[]; | ||
| ReScript: string[]; | ||
| "reST (reStructuredText)": string[]; | ||
| Rip: string[]; | ||
| Roboconf: string[]; | ||
| "Robot Framework": string[]; | ||
| Rust: string[]; | ||
| SAS: string[]; | ||
| "Sass (Sass)": string[]; | ||
| "Shell session": string[]; | ||
| Smali: string[]; | ||
| Smalltalk: string[]; | ||
| Smarty: string[]; | ||
| SML: string[]; | ||
| "Solidity (Ethereum)": string[]; | ||
| "Solution file": string[]; | ||
| Soy: string[]; | ||
| "Splunk SPL": string[]; | ||
| SQF: string[]; | ||
| Squirrel: string[]; | ||
| Stan: string[]; | ||
| "Stata Ado": string[]; | ||
| "Structured Text (IEC 61131-3)": string[]; | ||
| SuperCollider: string[]; | ||
| Swift: string[]; | ||
| "Systemd configuration file": string[]; | ||
| "T4 templating": string[]; | ||
| "T4 Text Templates (C#)": string[]; | ||
| "VB.Net": string[]; | ||
| "T4 Text Templates (VB)": string[]; | ||
| TAP: string[]; | ||
| Tcl: string[]; | ||
| "Template Toolkit 2": string[]; | ||
| TOML: string[]; | ||
| Tremor: string[]; | ||
| TypoScript: string[]; | ||
| UnrealScript: string[]; | ||
| "UO Razor Script": string[]; | ||
| V: string[]; | ||
| Vala: string[]; | ||
| Velocity: string[]; | ||
| Verilog: string[]; | ||
| VHDL: string[]; | ||
| vim: string[]; | ||
| "Visual Basic": string[]; | ||
| WarpScript: string[]; | ||
| WebAssembly: string[]; | ||
| "Web IDL": string[]; | ||
| WGSL: string[]; | ||
| "Wiki markup": string[]; | ||
| "Wolfram language": string[]; | ||
| Wren: string[]; | ||
| Xeora: string[]; | ||
| XQuery: string[]; | ||
| YANG: string[]; | ||
| Zig: string[]; | ||
| }; | ||
| export { type TypeSupportedLanguages, SupportedLanguages }; | ||
| //# sourceMappingURL=constants.d.ts.map |
| {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,KAAK,sBAAsB,GACv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S,GACT,IAAI,GACJ,SAAS,GACT,aAAa,GACb,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,aAAa,GACb,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,aAAa,GACb,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,aAAa,GACb,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,aAAa,GACb,IAAI,GACJ,MAAM,GACN,OAAO,GACP,WAAW,GACX,QAAQ,GACR,MAAM,GACN,KAAK,CAAC;AAEV,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyRvB,CAAC;AAEF,OAAO,EAAE,KAAK,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.SupportedLanguages = void 0; | ||
| const SupportedLanguages = { | ||
| Markup: ["markup", "html", "xml", "svg", "mathml", "ssml", "atom", "rss"], | ||
| CSS: ["css"], | ||
| C_like: ["clike"], | ||
| Regex: ["regex"], | ||
| JavaScript: ["javascript", "js"], | ||
| ABAP: ["abap"], | ||
| ABNF: ["abnf"], | ||
| ActionScript: ["actionscript"], | ||
| Ada: ["ada"], | ||
| Agda: ["agda"], | ||
| AL: ["al"], | ||
| ANTLR4: ["antlr4", "g4"], | ||
| "Apache Configuration": ["apacheconf"], | ||
| SQL: ["sql"], | ||
| Apex: ["apex"], | ||
| APL: ["apl"], | ||
| AppleScript: ["applescript"], | ||
| AQL: ["aql"], | ||
| C: ["c"], | ||
| "C++": ["cpp"], | ||
| Arduino: ["arduino", "ino"], | ||
| ARFF: ["arff"], | ||
| "ARM Assembly": ["armasm", "arm-asm"], | ||
| Bash: ["bash", "sh", "shell"], | ||
| YAML: ["yaml", "yml"], | ||
| Markdown: ["markdown", "md"], | ||
| Arturo: ["arturo", "art"], | ||
| AsciiDoc: ["asciidoc", "adoc"], | ||
| "C#": ["csharp", "cs", "dotnet"], | ||
| "ASP.NET (C#)": ["aspnet"], | ||
| "6502 Assembly": ["asm6502"], | ||
| "Atmel AVR Assembly": ["asmatmel"], | ||
| AutoHotkey: ["autohotkey"], | ||
| AutoIt: ["autoit"], | ||
| AviSynth: ["avisynth", "avs"], | ||
| "Avro IDL": ["avro-idl", "avdl"], | ||
| AWK: ["awk", "gawk"], | ||
| BASIC: ["basic"], | ||
| Batch: ["batch"], | ||
| BBcode: ["bbcode", "shortcode"], | ||
| BBj: ["bbj"], | ||
| Bicep: ["bicep"], | ||
| Birb: ["birb"], | ||
| Bison: ["bison"], | ||
| BNF: ["bnf", "rbnf"], | ||
| BQN: ["bqn"], | ||
| Brainfuck: ["brainfuck"], | ||
| BrightScript: ["brightscript"], | ||
| Bro: ["bro"], | ||
| CFScript: ["cfscript", "cfc"], | ||
| ChaiScript: ["chaiscript"], | ||
| CIL: ["cil"], | ||
| "Cilk/C": ["cilkc", "cilk-c"], | ||
| "Cilk/C++": ["cilkcpp", "cilkcpp", "cilk-cpp", "cilk"], | ||
| Clojure: ["clojure"], | ||
| CMake: ["cmake"], | ||
| COBOL: ["cobol"], | ||
| CoffeeScript: ["coffeescript", "coffee"], | ||
| Concurnas: ["concurnas", "conc"], | ||
| "Content-Security-Policy": ["csp"], | ||
| Cooklang: ["cooklang"], | ||
| Ruby: ["ruby", "rb"], | ||
| Crystal: ["crystal"], | ||
| CSV: ["csv"], | ||
| CUE: ["cue"], | ||
| Cypher: ["cypher"], | ||
| D: ["d"], | ||
| Dart: ["dart"], | ||
| DataWeave: ["dataweave"], | ||
| DAX: ["dax"], | ||
| Dhall: ["dhall"], | ||
| Diff: ["diff"], | ||
| "Markup templating": ["markup-templating"], | ||
| "Django/Jinja2": ["django", "jinja2"], | ||
| "DNS zone file": ["dns-zone-file", "dns-zone"], | ||
| Docker: ["docker", "dockerfile"], | ||
| "DOT (Graphviz)": ["dot", "gv"], | ||
| EBNF: ["ebnf"], | ||
| EditorConfig: ["editorconfig"], | ||
| Eiffel: ["eiffel"], | ||
| EJS: ["ejs", "eta"], | ||
| Elixir: ["elixir"], | ||
| Elm: ["elm"], | ||
| Lua: ["lua"], | ||
| "Embedded Lua templating": ["etlua"], | ||
| ERB: ["erb"], | ||
| Erlang: ["erlang"], | ||
| "Excel Formula": ["excel-formula", "xlsx", "xls"], | ||
| "F#": ["fsharp"], | ||
| Factor: ["factor"], | ||
| False: ["false"], | ||
| "Firestore security rules": ["firestore-security-rules"], | ||
| Flow: ["flow"], | ||
| Fortran: ["fortran"], | ||
| "FreeMarker Template Language": ["ftl"], | ||
| "GameMaker Language": ["gml", "gamemakerlanguage"], | ||
| "GAP (CAS)": ["gap"], | ||
| "G-code": ["gcode"], | ||
| GDScript: ["gdscript"], | ||
| GEDCOM: ["gedcom"], | ||
| gettext: ["gettext", "po"], | ||
| Git: ["git"], | ||
| GLSL: ["glsl"], | ||
| GN: ["gn", "gni"], | ||
| "GNU Linker Script": ["linker-script", "ld"], | ||
| Go: ["go"], | ||
| "Go module": ["go-module", "go-mod"], | ||
| GraphQL: ["graphql"], | ||
| Groovy: ["groovy"], | ||
| Less: ["less"], | ||
| "Sass (SCSS)": ["scss"], | ||
| Textile: ["textile"], | ||
| Haml: ["haml"], | ||
| Handlebars: ["handlebars", "handlebars", "hbs", "mustache"], | ||
| Haskell: ["haskell", "hs"], | ||
| Haxe: ["haxe"], | ||
| HCL: ["hcl"], | ||
| HLSL: ["hlsl"], | ||
| Hoon: ["hoon"], | ||
| "HTTP Public-Key-Pins": ["hpkp"], | ||
| "HTTP Strict-Transport-Security": ["hsts"], | ||
| JSON: ["json", "webmanifest"], | ||
| URI: ["uri", "url"], | ||
| HTTP: ["http"], | ||
| IchigoJam: ["ichigojam"], | ||
| Icon: ["icon"], | ||
| "ICU Message Format": ["icu-message-format"], | ||
| Idris: ["idris", "idr"], | ||
| ignore: ["ignore", "ignore", "gitignore", "hgignore", "npmignore"], | ||
| "Inform 7": ["inform7"], | ||
| Ini: ["ini"], | ||
| Io: ["io"], | ||
| J: ["j"], | ||
| Java: ["java"], | ||
| Scala: ["scala"], | ||
| PHP: ["php"], | ||
| "JavaDoc-like": ["javadoclike"], | ||
| JavaDoc: ["javadoc"], | ||
| "Java stack trace": ["javastacktrace"], | ||
| Jolie: ["jolie"], | ||
| JQ: ["jq"], | ||
| TypeScript: ["typescript", "ts"], | ||
| JSDoc: ["jsdoc"], | ||
| N4JS: ["n4js", "n4jsd"], | ||
| JSON5: ["json5"], | ||
| JSONP: ["jsonp"], | ||
| "JS stack trace": ["jsstacktrace"], | ||
| Julia: ["julia"], | ||
| Keepalived: ["keepalived"], | ||
| Keyman: ["keyman"], | ||
| Kotlin: ["kotlin", "kotlin", "kt", "kts"], | ||
| Kusto: ["kusto"], | ||
| LaTeX: ["latex", "latex", "tex", "context"], | ||
| Latte: ["latte"], | ||
| Scheme: ["scheme"], | ||
| LilyPond: ["lilypond", "ly"], | ||
| Liquid: ["liquid"], | ||
| Lisp: ["lisp", "lisp", "emacs", "elisp", "emacs-lisp"], | ||
| LiveScript: ["livescript"], | ||
| "LLVM IR": ["llvm"], | ||
| "Log file": ["log"], | ||
| LOLCODE: ["lolcode"], | ||
| "Magma (CAS)": ["magma"], | ||
| Makefile: ["makefile"], | ||
| Mata: ["mata"], | ||
| MATLAB: ["matlab"], | ||
| MAXScript: ["maxscript"], | ||
| MEL: ["mel"], | ||
| Mermaid: ["mermaid"], | ||
| METAFONT: ["metafont"], | ||
| Mizar: ["mizar"], | ||
| MongoDB: ["mongodb"], | ||
| Monkey: ["monkey"], | ||
| MoonScript: ["moonscript", "moon"], | ||
| N1QL: ["n1ql"], | ||
| "Nand To Tetris HDL": ["nand2tetris-hdl"], | ||
| Naninovel: ["naniscript", "nani"], | ||
| NASM: ["nasm"], | ||
| NEON: ["neon"], | ||
| Nevod: ["nevod"], | ||
| nginx: ["nginx"], | ||
| Nim: ["nim"], | ||
| Nix: ["nix"], | ||
| NSIS: ["nsis"], | ||
| ObjectiveC: ["objectivec", "objc"], | ||
| OCaml: ["ocaml"], | ||
| Odin: ["odin"], | ||
| OpenCL: ["opencl"], | ||
| OpenQasm: ["openqasm", "qasm"], | ||
| Oz: ["oz"], | ||
| "PARI/GP": ["parigp"], | ||
| Parser: ["parser"], | ||
| Pascal: ["pascal", "objectpascal"], | ||
| Pascaligo: ["pascaligo"], | ||
| "PATROL Scripting Language": ["psl"], | ||
| "PC-Axis": ["pcaxis", "px"], | ||
| PeopleCode: ["peoplecode", "pcode"], | ||
| Perl: ["perl"], | ||
| PHPDoc: ["phpdoc"], | ||
| PlantUML: ["plant-uml", "plantuml"], | ||
| "PL/SQL": ["plsql"], | ||
| PowerQuery: ["powerquery", "powerquery", "pq", "mscript"], | ||
| PowerShell: ["powershell"], | ||
| Processing: ["processing"], | ||
| Prolog: ["prolog"], | ||
| PromQL: ["promql"], | ||
| properties: ["properties"], | ||
| "Protocol Buffers": ["protobuf"], | ||
| Stylus: ["stylus"], | ||
| Twig: ["twig"], | ||
| Pug: ["pug"], | ||
| Puppet: ["puppet"], | ||
| PureBasic: ["purebasic", "pbfasm"], | ||
| Python: ["python", "py"], | ||
| Q: ["qsharp", "qs"], | ||
| QML: ["qml"], | ||
| Qore: ["qore"], | ||
| R: ["r"], | ||
| Racket: ["racket", "rkt"], | ||
| "Razor C#": ["cshtml", "razor"], | ||
| "React JSX": ["jsx"], | ||
| "React TSX": ["tsx"], | ||
| Reason: ["reason"], | ||
| Rego: ["rego"], | ||
| "Ren'py": ["renpy", "rpy"], | ||
| ReScript: ["rescript", "res"], | ||
| "reST (reStructuredText)": ["rest"], | ||
| Rip: ["rip"], | ||
| Roboconf: ["roboconf"], | ||
| "Robot Framework": ["robotframework", "robot"], | ||
| Rust: ["rust"], | ||
| SAS: ["sas"], | ||
| "Sass (Sass)": ["sass"], | ||
| "Shell session": ["shell-session", "sh-session", "shellsession"], | ||
| Smali: ["smali"], | ||
| Smalltalk: ["smalltalk"], | ||
| Smarty: ["smarty"], | ||
| SML: ["sml", "smlnj"], | ||
| "Solidity (Ethereum)": ["solidity", "sol"], | ||
| "Solution file": ["solution-file", "sln"], | ||
| Soy: ["soy"], | ||
| "Splunk SPL": ["splunk-spl"], | ||
| SQF: ["sqf"], | ||
| Squirrel: ["squirrel"], | ||
| Stan: ["stan"], | ||
| "Stata Ado": ["stata"], | ||
| "Structured Text (IEC 61131-3)": ["iecst"], | ||
| SuperCollider: ["supercollider", "sclang"], | ||
| Swift: ["swift"], | ||
| "Systemd configuration file": ["systemd"], | ||
| "T4 templating": ["t4-templating"], | ||
| "T4 Text Templates (C#)": ["t4-cs", "t4"], | ||
| "VB.Net": ["vbnet"], | ||
| "T4 Text Templates (VB)": ["t4-vb"], | ||
| TAP: ["tap"], | ||
| Tcl: ["tcl"], | ||
| "Template Toolkit 2": ["tt2"], | ||
| TOML: ["toml"], | ||
| Tremor: ["tremor", "trickle", "troy"], | ||
| TypoScript: ["typoscript", "tsconfig"], | ||
| UnrealScript: ["unrealscript", "uscript", "uc"], | ||
| "UO Razor Script": ["uorazor"], | ||
| V: ["v"], | ||
| Vala: ["vala"], | ||
| Velocity: ["velocity"], | ||
| Verilog: ["verilog"], | ||
| VHDL: ["vhdl"], | ||
| vim: ["vim"], | ||
| "Visual Basic": ["visual-basic", "vb", "vba", "vbs"], | ||
| WarpScript: ["warpscript"], | ||
| WebAssembly: ["wasm"], | ||
| "Web IDL": ["web-idl", "webidl"], | ||
| WGSL: ["wgsl"], | ||
| "Wiki markup": ["wiki"], | ||
| "Wolfram language": ["wolfram", "mathematica", "wl", "nb"], | ||
| Wren: ["wren"], | ||
| Xeora: ["xeora", "xeoracube"], | ||
| XQuery: ["xquery"], | ||
| YANG: ["yang"], | ||
| Zig: ["zig"], | ||
| }; | ||
| exports.SupportedLanguages = SupportedLanguages; | ||
| //# sourceMappingURL=constants.js.map |
| {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAsdA,MAAM,kBAAkB,GAAG;IACzB,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACzE,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,KAAK,EAAE,CAAC,OAAO,CAAC;IAChB,UAAU,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,cAAc,CAAC;IAC9B,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,EAAE,EAAE,CAAC,IAAI,CAAC;IACV,MAAM,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,sBAAsB,EAAE,CAAC,YAAY,CAAC;IACtC,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,CAAC,EAAE,CAAC,GAAG,CAAC;IACR,KAAK,EAAE,CAAC,KAAK,CAAC;IACd,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;IAC3B,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,cAAc,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrC,IAAI,EAAE,CAAC,M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GAAG,CAAC;IACR,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,cAAc,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;IACpD,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,WAAW,EAAE,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IAChC,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,MAAM,CAAC;IACvB,kBAAkB,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC;IAC1D,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;IAC7B,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,GAAG,EAAE,CAAC,KAAK,CAAC;CACb,CAAC;AAEoC,gDAAkB"} |
| import type { TypeSupportedLanguages } from "./constants"; | ||
| /** | ||
| * Wraps the text in bold HTML tags. | ||
| * @param text - The text to be wrapped in bold tags. | ||
| * @returns The bolded HTML string. | ||
| */ | ||
| declare function bold(text: string): string; | ||
| /** | ||
| * Wraps the text in strong HTML tags. | ||
| * @param text - The text to be wrapped in strong tags. | ||
| * @returns The HTML string with strong emphasis. | ||
| */ | ||
| declare function strong(text: string): string; | ||
| /** | ||
| * Wraps the text in italic HTML tags. | ||
| * @param text - The text to be wrapped in italic tags. | ||
| * @returns The italicized HTML string. | ||
| */ | ||
| declare function italic(text: string): string; | ||
| /** | ||
| * Wraps the text in emphasis HTML tags. | ||
| * @param text - The text to be wrapped in emphasis tags. | ||
| * @returns The emphasized HTML string. | ||
| */ | ||
| declare function emphasis(text: string): string; | ||
| /** | ||
| * Wraps the text in underline HTML tags. | ||
| * @param text - The text to be wrapped in underline tags. | ||
| * @returns The underlined HTML string. | ||
| */ | ||
| declare function underline(text: string): string; | ||
| /** | ||
| * Wraps the text in insert HTML tags. | ||
| * @param text - The text to be wrapped in insert tags. | ||
| * @returns The HTML string with inserted text. | ||
| */ | ||
| declare function ins(text: string): string; | ||
| /** | ||
| * Wraps the text in strikethrough HTML tags. | ||
| * @param text - The text to be wrapped in strikethrough tags. | ||
| * @returns The HTML string with strikethrough text. | ||
| */ | ||
| declare function strikethrough(text: string): string; | ||
| /** | ||
| * Wraps the text in strike HTML tags. | ||
| * @param text - The text to be wrapped in strike tags. | ||
| * @returns The HTML string with strikethrough (strike) text. | ||
| */ | ||
| declare function strike(text: string): string; | ||
| /** | ||
| * Wraps the text in delete HTML tags. | ||
| * @param text - The text to be wrapped in delete tags. | ||
| * @returns The HTML string with deleted text. | ||
| */ | ||
| declare function del(text: string): string; | ||
| /** | ||
| * Wraps the text in Telegram spoiler HTML tags. | ||
| * @param text - The text to be wrapped in spoiler tags. | ||
| * @returns The HTML string with Telegram spoiler formatting. | ||
| */ | ||
| declare function spoiler(text: string): string; | ||
| /** | ||
| * Wraps the text in Telegram-specific spoiler tags. | ||
| * @param text - The text to be wrapped in Telegram spoiler tags. | ||
| * @returns The HTML string with Telegram-specific spoiler formatting. | ||
| */ | ||
| declare function tgSpoiler(text: string): string; | ||
| /** | ||
| * Creates an inline URL link with the given text and URL. | ||
| * @param text - The display text for the link. | ||
| * @param url - The URL to link to. | ||
| * @returns The HTML string for an inline link. | ||
| */ | ||
| declare function inlineURL(text: string, url: string): string; | ||
| /** | ||
| * Creates an inline mention of a Telegram user by their user ID. | ||
| * @param text - The display text for the mention. | ||
| * @param userId - The Telegram user ID to mention. | ||
| * @returns The HTML string for an inline mention. | ||
| */ | ||
| declare function inlineMention(text: string, userId: string): string; | ||
| /** | ||
| * Creates an inline emoji using the provided emoji ID. | ||
| * @param emojiId - The ID of the emoji to include. | ||
| * @returns The HTML string for an inline emoji. | ||
| */ | ||
| declare function inlineEmoji(emojiId: string): string; | ||
| /** | ||
| * Wraps the text in inline code HTML tags. | ||
| * @param text - The text to be wrapped in inline code tags. | ||
| * @returns The HTML string with inline code formatting. | ||
| */ | ||
| declare function inlineCode(text: string): string; | ||
| /** | ||
| * Wraps the text in blockquote HTML tags. | ||
| * @param text - The text to be wrapped in blockquote tags. | ||
| * @returns The HTML string with blockquote formatting. | ||
| */ | ||
| declare function blockquote(text: string): string; | ||
| /** | ||
| * Wraps the text in expandable blockquote HTML tags. | ||
| * @param text - The text to be wrapped in expandable blockquote tags. | ||
| * @returns The HTML string with expandable blockquote formatting. | ||
| */ | ||
| declare function blockquoteExpandable(text: string): string; | ||
| /** | ||
| * Wraps the text in preformatted code block HTML tags. | ||
| * @param text - The text to be wrapped in preformatted code block tags. | ||
| * @returns The HTML string with preformatted code block formatting. | ||
| */ | ||
| declare function preFormattedCodeBlock(text: string): string; | ||
| /** | ||
| * Wraps the text in a preformatted code block with a specified language. | ||
| * @param text - The text to be wrapped in a preformatted code block. | ||
| * @param language - The programming language of the code block. | ||
| * @returns The HTML string with preformatted code block formatting and language specification. | ||
| */ | ||
| declare function preFormattedCodeBlockLanguage(text: string, language: TypeSupportedLanguages): string; | ||
| declare const _default: { | ||
| bold: typeof bold; | ||
| strong: typeof strong; | ||
| italic: typeof italic; | ||
| emphasis: typeof emphasis; | ||
| underline: typeof underline; | ||
| ins: typeof ins; | ||
| strikethrough: typeof strikethrough; | ||
| strike: typeof strike; | ||
| del: typeof del; | ||
| spoiler: typeof spoiler; | ||
| tgSpoiler: typeof tgSpoiler; | ||
| inlineURL: typeof inlineURL; | ||
| inlineMention: typeof inlineMention; | ||
| inlineEmoji: typeof inlineEmoji; | ||
| inlineCode: typeof inlineCode; | ||
| blockquote: typeof blockquote; | ||
| blockquoteExpandable: typeof blockquoteExpandable; | ||
| preFormattedCodeBlock: typeof preFormattedCodeBlock; | ||
| preFormattedCodeBlockLanguage: typeof preFormattedCodeBlockLanguage; | ||
| }; | ||
| export default _default; | ||
| //# sourceMappingURL=html.d.ts.map |
| {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;GAIG;AACH,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElC;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED;;;;GAIG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED;;;;GAIG;AACH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED;;;;GAIG;AACH,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjC;AAED;;;;GAIG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED;;;;GAIG;AACH,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjC;AAED;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErC;AAED;;;;GAIG;AACH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED;;;;;GAKG;AACH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,iBAAS,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,iBAAS,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;GAKG;AACH,iBAAS,6BAA6B,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,sBAAsB,GAC/B,MAAM,CAER;;;;;;;;;;;;;;;;;;;;;;AAED,wBAoBE"} |
-179
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** | ||
| * Wraps the text in bold HTML tags. | ||
| * @param text - The text to be wrapped in bold tags. | ||
| * @returns The bolded HTML string. | ||
| */ | ||
| function bold(text) { | ||
| return `<b>${text}</b>`; | ||
| } | ||
| /** | ||
| * Wraps the text in strong HTML tags. | ||
| * @param text - The text to be wrapped in strong tags. | ||
| * @returns The HTML string with strong emphasis. | ||
| */ | ||
| function strong(text) { | ||
| return `<strong>${text}</strong>`; | ||
| } | ||
| /** | ||
| * Wraps the text in italic HTML tags. | ||
| * @param text - The text to be wrapped in italic tags. | ||
| * @returns The italicized HTML string. | ||
| */ | ||
| function italic(text) { | ||
| return `<i>${text}</i>`; | ||
| } | ||
| /** | ||
| * Wraps the text in emphasis HTML tags. | ||
| * @param text - The text to be wrapped in emphasis tags. | ||
| * @returns The emphasized HTML string. | ||
| */ | ||
| function emphasis(text) { | ||
| return `<em>${text}</em>`; | ||
| } | ||
| /** | ||
| * Wraps the text in underline HTML tags. | ||
| * @param text - The text to be wrapped in underline tags. | ||
| * @returns The underlined HTML string. | ||
| */ | ||
| function underline(text) { | ||
| return `<u>${text}</u>`; | ||
| } | ||
| /** | ||
| * Wraps the text in insert HTML tags. | ||
| * @param text - The text to be wrapped in insert tags. | ||
| * @returns The HTML string with inserted text. | ||
| */ | ||
| function ins(text) { | ||
| return `<ins>${text}</ins>`; | ||
| } | ||
| /** | ||
| * Wraps the text in strikethrough HTML tags. | ||
| * @param text - The text to be wrapped in strikethrough tags. | ||
| * @returns The HTML string with strikethrough text. | ||
| */ | ||
| function strikethrough(text) { | ||
| return `<s>${text}</s>`; | ||
| } | ||
| /** | ||
| * Wraps the text in strike HTML tags. | ||
| * @param text - The text to be wrapped in strike tags. | ||
| * @returns The HTML string with strikethrough (strike) text. | ||
| */ | ||
| function strike(text) { | ||
| return `<strike>${text}</strike>`; | ||
| } | ||
| /** | ||
| * Wraps the text in delete HTML tags. | ||
| * @param text - The text to be wrapped in delete tags. | ||
| * @returns The HTML string with deleted text. | ||
| */ | ||
| function del(text) { | ||
| return `<del>${text}</del>`; | ||
| } | ||
| /** | ||
| * Wraps the text in Telegram spoiler HTML tags. | ||
| * @param text - The text to be wrapped in spoiler tags. | ||
| * @returns The HTML string with Telegram spoiler formatting. | ||
| */ | ||
| function spoiler(text) { | ||
| return `<span class="tg-spoiler">${text}</span>`; | ||
| } | ||
| /** | ||
| * Wraps the text in Telegram-specific spoiler tags. | ||
| * @param text - The text to be wrapped in Telegram spoiler tags. | ||
| * @returns The HTML string with Telegram-specific spoiler formatting. | ||
| */ | ||
| function tgSpoiler(text) { | ||
| return `<tg-spoiler>${text}</tg-spoiler>`; | ||
| } | ||
| /** | ||
| * Creates an inline URL link with the given text and URL. | ||
| * @param text - The display text for the link. | ||
| * @param url - The URL to link to. | ||
| * @returns The HTML string for an inline link. | ||
| */ | ||
| function inlineURL(text, url) { | ||
| return `<a href="${url}">${text}</a>`; | ||
| } | ||
| /** | ||
| * Creates an inline mention of a Telegram user by their user ID. | ||
| * @param text - The display text for the mention. | ||
| * @param userId - The Telegram user ID to mention. | ||
| * @returns The HTML string for an inline mention. | ||
| */ | ||
| function inlineMention(text, userId) { | ||
| return `<a href="tg://user?id=${userId}">${text}</a>`; | ||
| } | ||
| /** | ||
| * Creates an inline emoji using the provided emoji ID. | ||
| * @param emojiId - The ID of the emoji to include. | ||
| * @returns The HTML string for an inline emoji. | ||
| */ | ||
| function inlineEmoji(emojiId) { | ||
| return `<tg-emoji emoji-id="${emojiId}">👍</tg-emoji>`; | ||
| } | ||
| /** | ||
| * Wraps the text in inline code HTML tags. | ||
| * @param text - The text to be wrapped in inline code tags. | ||
| * @returns The HTML string with inline code formatting. | ||
| */ | ||
| function inlineCode(text) { | ||
| return `<code>${text}</code>`; | ||
| } | ||
| /** | ||
| * Wraps the text in blockquote HTML tags. | ||
| * @param text - The text to be wrapped in blockquote tags. | ||
| * @returns The HTML string with blockquote formatting. | ||
| */ | ||
| function blockquote(text) { | ||
| return `<blockquote>${text}</blockquote>`; | ||
| } | ||
| /** | ||
| * Wraps the text in expandable blockquote HTML tags. | ||
| * @param text - The text to be wrapped in expandable blockquote tags. | ||
| * @returns The HTML string with expandable blockquote formatting. | ||
| */ | ||
| function blockquoteExpandable(text) { | ||
| return `<blockquote expandable>${text}</blockquote>`; | ||
| } | ||
| /** | ||
| * Wraps the text in preformatted code block HTML tags. | ||
| * @param text - The text to be wrapped in preformatted code block tags. | ||
| * @returns The HTML string with preformatted code block formatting. | ||
| */ | ||
| function preFormattedCodeBlock(text) { | ||
| return `<pre>${text}</pre>`; | ||
| } | ||
| /** | ||
| * Wraps the text in a preformatted code block with a specified language. | ||
| * @param text - The text to be wrapped in a preformatted code block. | ||
| * @param language - The programming language of the code block. | ||
| * @returns The HTML string with preformatted code block formatting and language specification. | ||
| */ | ||
| function preFormattedCodeBlockLanguage(text, language) { | ||
| return `<pre><code class="language-${language}">${text}</code></pre>`; | ||
| } | ||
| exports.default = { | ||
| bold, | ||
| strong, | ||
| italic, | ||
| emphasis, | ||
| underline, | ||
| ins, | ||
| strikethrough, | ||
| strike, | ||
| del, | ||
| spoiler, | ||
| tgSpoiler, | ||
| inlineURL, | ||
| inlineMention, | ||
| inlineEmoji, | ||
| inlineCode, | ||
| blockquote, | ||
| blockquoteExpandable, | ||
| preFormattedCodeBlock, | ||
| preFormattedCodeBlockLanguage, | ||
| }; | ||
| //# sourceMappingURL=html.js.map |
| {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/html.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;AACH,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,MAAM,IAAI,MAAM,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,WAAW,IAAI,WAAW,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,MAAM,IAAI,MAAM,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,OAAO,IAAI,OAAO,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,MAAM,IAAI,MAAM,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,MAAM,IAAI,MAAM,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,WAAW,IAAI,WAAW,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,4BAA4B,IAAI,SAAS,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,eAAe,IAAI,eAAe,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,GAAW;IAC1C,OAAO,YAAY,GAAG,KAAK,IAAI,MAAM,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,MAAc;IACjD,OAAO,yBAAyB,MAAM,KAAK,IAAI,MAAM,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,uBAAuB,OAAO,iBAAiB,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,SAAS,IAAI,SAAS,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,eAAe,IAAI,eAAe,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,0BAA0B,IAAI,eAAe,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAS,6BAA6B,CACpC,IAAY,EACZ,QAAgC;IAEhC,OAAO,8BAA8B,QAAQ,KAAK,IAAI,eAAe,CAAC;AACxE,CAAC;AAED,kBAAe;IACb,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,GAAG;IACH,aAAa;IACb,MAAM;IACN,GAAG;IACH,OAAO;IACP,SAAS;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,UAAU;IACV,UAAU;IACV,oBAAoB;IACpB,qBAAqB;IACrB,6BAA6B;CAC9B,CAAC"} |
| import { html, markdownv, parseEntities, type TypeSupportedLanguages, SupportedLanguages } from "./index.js"; | ||
| declare const _default: { | ||
| html: { | ||
| bold: (text: string) => string; | ||
| strong: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| emphasis: (text: string) => string; | ||
| underline: (text: string) => string; | ||
| ins: (text: string) => string; | ||
| strikethrough: (text: string) => string; | ||
| strike: (text: string) => string; | ||
| del: (text: string) => string; | ||
| spoiler: (text: string) => string; | ||
| tgSpoiler: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineEmoji: (emojiId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| blockquote: (text: string) => string; | ||
| blockquoteExpandable: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| markdownv: { | ||
| v1: { | ||
| bold: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| bold: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| underline: (text: string) => string; | ||
| strikethrough: (text: string) => string; | ||
| spoiler: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineEmoji: (emojiId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| blockquote: (text: string) => string; | ||
| blockquoteExpandable: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| parseEntities: typeof parseEntities; | ||
| version: string; | ||
| SupportedLanguages: { | ||
| Markup: string[]; | ||
| CSS: string[]; | ||
| C_like: string[]; | ||
| Regex: string[]; | ||
| JavaScript: string[]; | ||
| ABAP: string[]; | ||
| ABNF: string[]; | ||
| ActionScript: string[]; | ||
| Ada: string[]; | ||
| Agda: string[]; | ||
| AL: string[]; | ||
| ANTLR4: string[]; | ||
| "Apache Configuration": string[]; | ||
| SQL: string[]; | ||
| Apex: string[]; | ||
| APL: string[]; | ||
| AppleScript: string[]; | ||
| AQL: string[]; | ||
| C: string[]; | ||
| "C++": string[]; | ||
| Arduino: string[]; | ||
| ARFF: string[]; | ||
| "ARM Assembly": string[]; | ||
| Bash: string[]; | ||
| YAML: string[]; | ||
| Markdown: string[]; | ||
| Arturo: string[]; | ||
| AsciiDoc: string[]; | ||
| "C#": string[]; | ||
| "ASP.NET (C#)": string[]; | ||
| "6502 Assembly": string[]; | ||
| "Atmel AVR Assembly": string[]; | ||
| AutoHotkey: string[]; | ||
| AutoIt: string[]; | ||
| AviSynth: string[]; | ||
| "Avro IDL": string[]; | ||
| AWK: string[]; | ||
| BASIC: string[]; | ||
| Batch: string[]; | ||
| BBcode: string[]; | ||
| BBj: string[]; | ||
| Bicep: string[]; | ||
| Birb: string[]; | ||
| Bison: string[]; | ||
| BNF: string[]; | ||
| BQN: string[]; | ||
| Brainfuck: string[]; | ||
| BrightScript: string[]; | ||
| Bro: string[]; | ||
| CFScript: string[]; | ||
| ChaiScript: string[]; | ||
| CIL: string[]; | ||
| "Cilk/C": string[]; | ||
| "Cilk/C++": string[]; | ||
| Clojure: string[]; | ||
| CMake: string[]; | ||
| COBOL: string[]; | ||
| CoffeeScript: string[]; | ||
| Concurnas: string[]; | ||
| "Content-Security-Policy": string[]; | ||
| Cooklang: string[]; | ||
| Ruby: string[]; | ||
| Crystal: string[]; | ||
| CSV: string[]; | ||
| CUE: string[]; | ||
| Cypher: string[]; | ||
| D: string[]; | ||
| Dart: string[]; | ||
| DataWeave: string[]; | ||
| DAX: string[]; | ||
| Dhall: string[]; | ||
| Diff: string[]; | ||
| "Markup templating": string[]; | ||
| "Django/Jinja2": string[]; | ||
| "DNS zone file": string[]; | ||
| Docker: string[]; | ||
| "DOT (Graphviz)": string[]; | ||
| EBNF: string[]; | ||
| EditorConfig: string[]; | ||
| Eiffel: string[]; | ||
| EJS: string[]; | ||
| Elixir: string[]; | ||
| Elm: string[]; | ||
| Lua: string[]; | ||
| "Embedded Lua templating": string[]; | ||
| ERB: string[]; | ||
| Erlang: string[]; | ||
| "Excel Formula": string[]; | ||
| "F#": string[]; | ||
| Factor: string[]; | ||
| False: string[]; | ||
| "Firestore security rules": string[]; | ||
| Flow: string[]; | ||
| Fortran: string[]; | ||
| "FreeMarker Template Language": string[]; | ||
| "GameMaker Language": string[]; | ||
| "GAP (CAS)": string[]; | ||
| "G-code": string[]; | ||
| GDScript: string[]; | ||
| GEDCOM: string[]; | ||
| gettext: string[]; | ||
| Git: string[]; | ||
| GLSL: string[]; | ||
| GN: string[]; | ||
| "GNU Linker Script": string[]; | ||
| Go: string[]; | ||
| "Go module": string[]; | ||
| GraphQL: string[]; | ||
| Groovy: string[]; | ||
| Less: string[]; | ||
| "Sass (SCSS)": string[]; | ||
| Textile: string[]; | ||
| Haml: string[]; | ||
| Handlebars: string[]; | ||
| Haskell: string[]; | ||
| Haxe: string[]; | ||
| HCL: string[]; | ||
| HLSL: string[]; | ||
| Hoon: string[]; | ||
| "HTTP Public-Key-Pins": string[]; | ||
| "HTTP Strict-Transport-Security": string[]; | ||
| JSON: string[]; | ||
| URI: string[]; | ||
| HTTP: string[]; | ||
| IchigoJam: string[]; | ||
| Icon: string[]; | ||
| "ICU Message Format": string[]; | ||
| Idris: string[]; | ||
| ignore: string[]; | ||
| "Inform 7": string[]; | ||
| Ini: string[]; | ||
| Io: string[]; | ||
| J: string[]; | ||
| Java: string[]; | ||
| Scala: string[]; | ||
| PHP: string[]; | ||
| "JavaDoc-like": string[]; | ||
| JavaDoc: string[]; | ||
| "Java stack trace": string[]; | ||
| Jolie: string[]; | ||
| JQ: string[]; | ||
| TypeScript: string[]; | ||
| JSDoc: string[]; | ||
| N4JS: string[]; | ||
| JSON5: string[]; | ||
| JSONP: string[]; | ||
| "JS stack trace": string[]; | ||
| Julia: string[]; | ||
| Keepalived: string[]; | ||
| Keyman: string[]; | ||
| Kotlin: string[]; | ||
| Kusto: string[]; | ||
| LaTeX: string[]; | ||
| Latte: string[]; | ||
| Scheme: string[]; | ||
| LilyPond: string[]; | ||
| Liquid: string[]; | ||
| Lisp: string[]; | ||
| LiveScript: string[]; | ||
| "LLVM IR": string[]; | ||
| "Log file": string[]; | ||
| LOLCODE: string[]; | ||
| "Magma (CAS)": string[]; | ||
| Makefile: string[]; | ||
| Mata: string[]; | ||
| MATLAB: string[]; | ||
| MAXScript: string[]; | ||
| MEL: string[]; | ||
| Mermaid: string[]; | ||
| METAFONT: string[]; | ||
| Mizar: string[]; | ||
| MongoDB: string[]; | ||
| Monkey: string[]; | ||
| MoonScript: string[]; | ||
| N1QL: string[]; | ||
| "Nand To Tetris HDL": string[]; | ||
| Naninovel: string[]; | ||
| NASM: string[]; | ||
| NEON: string[]; | ||
| Nevod: string[]; | ||
| nginx: string[]; | ||
| Nim: string[]; | ||
| Nix: string[]; | ||
| NSIS: string[]; | ||
| ObjectiveC: string[]; | ||
| OCaml: string[]; | ||
| Odin: string[]; | ||
| OpenCL: string[]; | ||
| OpenQasm: string[]; | ||
| Oz: string[]; | ||
| "PARI/GP": string[]; | ||
| Parser: string[]; | ||
| Pascal: string[]; | ||
| Pascaligo: string[]; | ||
| "PATROL Scripting Language": string[]; | ||
| "PC-Axis": string[]; | ||
| PeopleCode: string[]; | ||
| Perl: string[]; | ||
| PHPDoc: string[]; | ||
| PlantUML: string[]; | ||
| "PL/SQL": string[]; | ||
| PowerQuery: string[]; | ||
| PowerShell: string[]; | ||
| Processing: string[]; | ||
| Prolog: string[]; | ||
| PromQL: string[]; | ||
| properties: string[]; | ||
| "Protocol Buffers": string[]; | ||
| Stylus: string[]; | ||
| Twig: string[]; | ||
| Pug: string[]; | ||
| Puppet: string[]; | ||
| PureBasic: string[]; | ||
| Python: string[]; | ||
| Q: string[]; | ||
| QML: string[]; | ||
| Qore: string[]; | ||
| R: string[]; | ||
| Racket: string[]; | ||
| "Razor C#": string[]; | ||
| "React JSX": string[]; | ||
| "React TSX": string[]; | ||
| Reason: string[]; | ||
| Rego: string[]; | ||
| "Ren'py": string[]; | ||
| ReScript: string[]; | ||
| "reST (reStructuredText)": string[]; | ||
| Rip: string[]; | ||
| Roboconf: string[]; | ||
| "Robot Framework": string[]; | ||
| Rust: string[]; | ||
| SAS: string[]; | ||
| "Sass (Sass)": string[]; | ||
| "Shell session": string[]; | ||
| Smali: string[]; | ||
| Smalltalk: string[]; | ||
| Smarty: string[]; | ||
| SML: string[]; | ||
| "Solidity (Ethereum)": string[]; | ||
| "Solution file": string[]; | ||
| Soy: string[]; | ||
| "Splunk SPL": string[]; | ||
| SQF: string[]; | ||
| Squirrel: string[]; | ||
| Stan: string[]; | ||
| "Stata Ado": string[]; | ||
| "Structured Text (IEC 61131-3)": string[]; | ||
| SuperCollider: string[]; | ||
| Swift: string[]; | ||
| "Systemd configuration file": string[]; | ||
| "T4 templating": string[]; | ||
| "T4 Text Templates (C#)": string[]; | ||
| "VB.Net": string[]; | ||
| "T4 Text Templates (VB)": string[]; | ||
| TAP: string[]; | ||
| Tcl: string[]; | ||
| "Template Toolkit 2": string[]; | ||
| TOML: string[]; | ||
| Tremor: string[]; | ||
| TypoScript: string[]; | ||
| UnrealScript: string[]; | ||
| "UO Razor Script": string[]; | ||
| V: string[]; | ||
| Vala: string[]; | ||
| Velocity: string[]; | ||
| Verilog: string[]; | ||
| VHDL: string[]; | ||
| vim: string[]; | ||
| "Visual Basic": string[]; | ||
| WarpScript: string[]; | ||
| WebAssembly: string[]; | ||
| "Web IDL": string[]; | ||
| WGSL: string[]; | ||
| "Wiki markup": string[]; | ||
| "Wolfram language": string[]; | ||
| Wren: string[]; | ||
| Xeora: string[]; | ||
| XQuery: string[]; | ||
| YANG: string[]; | ||
| Zig: string[]; | ||
| }; | ||
| }; | ||
| export default _default; | ||
| export { html, markdownv, parseEntities, TypeSupportedLanguages, SupportedLanguages, }; | ||
| //# sourceMappingURL=index.d.mts.map |
| {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EAEb,KAAK,sBAAsB,EAC3B,kBAAkB,EACnB,MAAM,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,wBAA+E;AAC/E,OAAO,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,kBAAkB,GACnB,CAAC"} |
| import html from "./html"; | ||
| import markdownv from "./markdownv"; | ||
| import { parseEntities, escapeHTML, escapeMarkdown, htmlEntityPatterns, markdownPatterns, markdownV2Patterns, type TypeEntity } from "./utils"; | ||
| import { version } from "../package.json"; | ||
| import { type TypeSupportedLanguages, SupportedLanguages } from "./constants"; | ||
| declare const _default: { | ||
| html: { | ||
| bold: (text: string) => string; | ||
| strong: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| emphasis: (text: string) => string; | ||
| underline: (text: string) => string; | ||
| ins: (text: string) => string; | ||
| strikethrough: (text: string) => string; | ||
| strike: (text: string) => string; | ||
| del: (text: string) => string; | ||
| spoiler: (text: string) => string; | ||
| tgSpoiler: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineEmoji: (emojiId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| blockquote: (text: string) => string; | ||
| blockquoteExpandable: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| markdownv: { | ||
| v1: { | ||
| bold: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| bold: (text: string) => string; | ||
| italic: (text: string) => string; | ||
| underline: (text: string) => string; | ||
| strikethrough: (text: string) => string; | ||
| spoiler: (text: string) => string; | ||
| inlineURL: (text: string, url: string) => string; | ||
| inlineMention: (text: string, userId: string) => string; | ||
| inlineEmoji: (emojiId: string) => string; | ||
| inlineCode: (text: string) => string; | ||
| blockquote: (text: string) => string; | ||
| blockquoteExpandable: (text: string) => string; | ||
| preFormattedCodeBlock: (text: string) => string; | ||
| preFormattedCodeBlockLanguage: (text: string, language: TypeSupportedLanguages) => string; | ||
| }; | ||
| parseEntities: typeof parseEntities; | ||
| escapeHTML: typeof escapeHTML; | ||
| escapeMarkdown: typeof escapeMarkdown; | ||
| htmlEntityPatterns: Record<string, RegExp>; | ||
| markdownPatterns: Record<string, RegExp>; | ||
| markdownV2Patterns: Record<string, RegExp>; | ||
| version: string; | ||
| SupportedLanguages: { | ||
| Markup: string[]; | ||
| CSS: string[]; | ||
| C_like: string[]; | ||
| Regex: string[]; | ||
| JavaScript: string[]; | ||
| ABAP: string[]; | ||
| ABNF: string[]; | ||
| ActionScript: string[]; | ||
| Ada: string[]; | ||
| Agda: string[]; | ||
| AL: string[]; | ||
| ANTLR4: string[]; | ||
| "Apache Configuration": string[]; | ||
| SQL: string[]; | ||
| Apex: string[]; | ||
| APL: string[]; | ||
| AppleScript: string[]; | ||
| AQL: string[]; | ||
| C: string[]; | ||
| "C++": string[]; | ||
| Arduino: string[]; | ||
| ARFF: string[]; | ||
| "ARM Assembly": string[]; | ||
| Bash: string[]; | ||
| YAML: string[]; | ||
| Markdown: string[]; | ||
| Arturo: string[]; | ||
| AsciiDoc: string[]; | ||
| "C#": string[]; | ||
| "ASP.NET (C#)": string[]; | ||
| "6502 Assembly": string[]; | ||
| "Atmel AVR Assembly": string[]; | ||
| AutoHotkey: string[]; | ||
| AutoIt: string[]; | ||
| AviSynth: string[]; | ||
| "Avro IDL": string[]; | ||
| AWK: string[]; | ||
| BASIC: string[]; | ||
| Batch: string[]; | ||
| BBcode: string[]; | ||
| BBj: string[]; | ||
| Bicep: string[]; | ||
| Birb: string[]; | ||
| Bison: string[]; | ||
| BNF: string[]; | ||
| BQN: string[]; | ||
| Brainfuck: string[]; | ||
| BrightScript: string[]; | ||
| Bro: string[]; | ||
| CFScript: string[]; | ||
| ChaiScript: string[]; | ||
| CIL: string[]; | ||
| "Cilk/C": string[]; | ||
| "Cilk/C++": string[]; | ||
| Clojure: string[]; | ||
| CMake: string[]; | ||
| COBOL: string[]; | ||
| CoffeeScript: string[]; | ||
| Concurnas: string[]; | ||
| "Content-Security-Policy": string[]; | ||
| Cooklang: string[]; | ||
| Ruby: string[]; | ||
| Crystal: string[]; | ||
| CSV: string[]; | ||
| CUE: string[]; | ||
| Cypher: string[]; | ||
| D: string[]; | ||
| Dart: string[]; | ||
| DataWeave: string[]; | ||
| DAX: string[]; | ||
| Dhall: string[]; | ||
| Diff: string[]; | ||
| "Markup templating": string[]; | ||
| "Django/Jinja2": string[]; | ||
| "DNS zone file": string[]; | ||
| Docker: string[]; | ||
| "DOT (Graphviz)": string[]; | ||
| EBNF: string[]; | ||
| EditorConfig: string[]; | ||
| Eiffel: string[]; | ||
| EJS: string[]; | ||
| Elixir: string[]; | ||
| Elm: string[]; | ||
| Lua: string[]; | ||
| "Embedded Lua templating": string[]; | ||
| ERB: string[]; | ||
| Erlang: string[]; | ||
| "Excel Formula": string[]; | ||
| "F#": string[]; | ||
| Factor: string[]; | ||
| False: string[]; | ||
| "Firestore security rules": string[]; | ||
| Flow: string[]; | ||
| Fortran: string[]; | ||
| "FreeMarker Template Language": string[]; | ||
| "GameMaker Language": string[]; | ||
| "GAP (CAS)": string[]; | ||
| "G-code": string[]; | ||
| GDScript: string[]; | ||
| GEDCOM: string[]; | ||
| gettext: string[]; | ||
| Git: string[]; | ||
| GLSL: string[]; | ||
| GN: string[]; | ||
| "GNU Linker Script": string[]; | ||
| Go: string[]; | ||
| "Go module": string[]; | ||
| GraphQL: string[]; | ||
| Groovy: string[]; | ||
| Less: string[]; | ||
| "Sass (SCSS)": string[]; | ||
| Textile: string[]; | ||
| Haml: string[]; | ||
| Handlebars: string[]; | ||
| Haskell: string[]; | ||
| Haxe: string[]; | ||
| HCL: string[]; | ||
| HLSL: string[]; | ||
| Hoon: string[]; | ||
| "HTTP Public-Key-Pins": string[]; | ||
| "HTTP Strict-Transport-Security": string[]; | ||
| JSON: string[]; | ||
| URI: string[]; | ||
| HTTP: string[]; | ||
| IchigoJam: string[]; | ||
| Icon: string[]; | ||
| "ICU Message Format": string[]; | ||
| Idris: string[]; | ||
| ignore: string[]; | ||
| "Inform 7": string[]; | ||
| Ini: string[]; | ||
| Io: string[]; | ||
| J: string[]; | ||
| Java: string[]; | ||
| Scala: string[]; | ||
| PHP: string[]; | ||
| "JavaDoc-like": string[]; | ||
| JavaDoc: string[]; | ||
| "Java stack trace": string[]; | ||
| Jolie: string[]; | ||
| JQ: string[]; | ||
| TypeScript: string[]; | ||
| JSDoc: string[]; | ||
| N4JS: string[]; | ||
| JSON5: string[]; | ||
| JSONP: string[]; | ||
| "JS stack trace": string[]; | ||
| Julia: string[]; | ||
| Keepalived: string[]; | ||
| Keyman: string[]; | ||
| Kotlin: string[]; | ||
| Kusto: string[]; | ||
| LaTeX: string[]; | ||
| Latte: string[]; | ||
| Scheme: string[]; | ||
| LilyPond: string[]; | ||
| Liquid: string[]; | ||
| Lisp: string[]; | ||
| LiveScript: string[]; | ||
| "LLVM IR": string[]; | ||
| "Log file": string[]; | ||
| LOLCODE: string[]; | ||
| "Magma (CAS)": string[]; | ||
| Makefile: string[]; | ||
| Mata: string[]; | ||
| MATLAB: string[]; | ||
| MAXScript: string[]; | ||
| MEL: string[]; | ||
| Mermaid: string[]; | ||
| METAFONT: string[]; | ||
| Mizar: string[]; | ||
| MongoDB: string[]; | ||
| Monkey: string[]; | ||
| MoonScript: string[]; | ||
| N1QL: string[]; | ||
| "Nand To Tetris HDL": string[]; | ||
| Naninovel: string[]; | ||
| NASM: string[]; | ||
| NEON: string[]; | ||
| Nevod: string[]; | ||
| nginx: string[]; | ||
| Nim: string[]; | ||
| Nix: string[]; | ||
| NSIS: string[]; | ||
| ObjectiveC: string[]; | ||
| OCaml: string[]; | ||
| Odin: string[]; | ||
| OpenCL: string[]; | ||
| OpenQasm: string[]; | ||
| Oz: string[]; | ||
| "PARI/GP": string[]; | ||
| Parser: string[]; | ||
| Pascal: string[]; | ||
| Pascaligo: string[]; | ||
| "PATROL Scripting Language": string[]; | ||
| "PC-Axis": string[]; | ||
| PeopleCode: string[]; | ||
| Perl: string[]; | ||
| PHPDoc: string[]; | ||
| PlantUML: string[]; | ||
| "PL/SQL": string[]; | ||
| PowerQuery: string[]; | ||
| PowerShell: string[]; | ||
| Processing: string[]; | ||
| Prolog: string[]; | ||
| PromQL: string[]; | ||
| properties: string[]; | ||
| "Protocol Buffers": string[]; | ||
| Stylus: string[]; | ||
| Twig: string[]; | ||
| Pug: string[]; | ||
| Puppet: string[]; | ||
| PureBasic: string[]; | ||
| Python: string[]; | ||
| Q: string[]; | ||
| QML: string[]; | ||
| Qore: string[]; | ||
| R: string[]; | ||
| Racket: string[]; | ||
| "Razor C#": string[]; | ||
| "React JSX": string[]; | ||
| "React TSX": string[]; | ||
| Reason: string[]; | ||
| Rego: string[]; | ||
| "Ren'py": string[]; | ||
| ReScript: string[]; | ||
| "reST (reStructuredText)": string[]; | ||
| Rip: string[]; | ||
| Roboconf: string[]; | ||
| "Robot Framework": string[]; | ||
| Rust: string[]; | ||
| SAS: string[]; | ||
| "Sass (Sass)": string[]; | ||
| "Shell session": string[]; | ||
| Smali: string[]; | ||
| Smalltalk: string[]; | ||
| Smarty: string[]; | ||
| SML: string[]; | ||
| "Solidity (Ethereum)": string[]; | ||
| "Solution file": string[]; | ||
| Soy: string[]; | ||
| "Splunk SPL": string[]; | ||
| SQF: string[]; | ||
| Squirrel: string[]; | ||
| Stan: string[]; | ||
| "Stata Ado": string[]; | ||
| "Structured Text (IEC 61131-3)": string[]; | ||
| SuperCollider: string[]; | ||
| Swift: string[]; | ||
| "Systemd configuration file": string[]; | ||
| "T4 templating": string[]; | ||
| "T4 Text Templates (C#)": string[]; | ||
| "VB.Net": string[]; | ||
| "T4 Text Templates (VB)": string[]; | ||
| TAP: string[]; | ||
| Tcl: string[]; | ||
| "Template Toolkit 2": string[]; | ||
| TOML: string[]; | ||
| Tremor: string[]; | ||
| TypoScript: string[]; | ||
| UnrealScript: string[]; | ||
| "UO Razor Script": string[]; | ||
| V: string[]; | ||
| Vala: string[]; | ||
| Velocity: string[]; | ||
| Verilog: string[]; | ||
| VHDL: string[]; | ||
| vim: string[]; | ||
| "Visual Basic": string[]; | ||
| WarpScript: string[]; | ||
| WebAssembly: string[]; | ||
| "Web IDL": string[]; | ||
| WGSL: string[]; | ||
| "Wiki markup": string[]; | ||
| "Wolfram language": string[]; | ||
| Wren: string[]; | ||
| Xeora: string[]; | ||
| XQuery: string[]; | ||
| YANG: string[]; | ||
| Zig: string[]; | ||
| }; | ||
| }; | ||
| export default _default; | ||
| export { html, markdownv, parseEntities, escapeHTML, escapeMarkdown, htmlEntityPatterns, markdownPatterns, markdownV2Patterns, version, type TypeEntity, type TypeSupportedLanguages, SupportedLanguages, }; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,KAAK,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9E,wBAWE;AACF,OAAO,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,kBAAkB,GACnB,CAAC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.SupportedLanguages = exports.version = exports.markdownV2Patterns = exports.markdownPatterns = exports.htmlEntityPatterns = exports.escapeMarkdown = exports.escapeHTML = exports.parseEntities = exports.markdownv = exports.html = void 0; | ||
| const html_1 = require("./html"); | ||
| exports.html = html_1.default; | ||
| const markdownv_1 = require("./markdownv"); | ||
| exports.markdownv = markdownv_1.default; | ||
| const utils_1 = require("./utils"); | ||
| Object.defineProperty(exports, "parseEntities", { enumerable: true, get: function () { return utils_1.parseEntities; } }); | ||
| Object.defineProperty(exports, "escapeHTML", { enumerable: true, get: function () { return utils_1.escapeHTML; } }); | ||
| Object.defineProperty(exports, "escapeMarkdown", { enumerable: true, get: function () { return utils_1.escapeMarkdown; } }); | ||
| Object.defineProperty(exports, "htmlEntityPatterns", { enumerable: true, get: function () { return utils_1.htmlEntityPatterns; } }); | ||
| Object.defineProperty(exports, "markdownPatterns", { enumerable: true, get: function () { return utils_1.markdownPatterns; } }); | ||
| Object.defineProperty(exports, "markdownV2Patterns", { enumerable: true, get: function () { return utils_1.markdownV2Patterns; } }); | ||
| const package_json_1 = require("../package.json"); | ||
| Object.defineProperty(exports, "version", { enumerable: true, get: function () { return package_json_1.version; } }); | ||
| const constants_1 = require("./constants"); | ||
| Object.defineProperty(exports, "SupportedLanguages", { enumerable: true, get: function () { return constants_1.SupportedLanguages; } }); | ||
| exports.default = { | ||
| html: html_1.default, | ||
| markdownv: markdownv_1.default, | ||
| parseEntities: utils_1.parseEntities, | ||
| escapeHTML: utils_1.escapeHTML, | ||
| escapeMarkdown: utils_1.escapeMarkdown, | ||
| htmlEntityPatterns: utils_1.htmlEntityPatterns, | ||
| markdownPatterns: utils_1.markdownPatterns, | ||
| markdownV2Patterns: utils_1.markdownV2Patterns, | ||
| version: package_json_1.version, | ||
| SupportedLanguages: constants_1.SupportedLanguages, | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AA2BxB,eA3BK,cAAI,CA2BL;AA1BN,2CAAoC;AA2BlC,oBA3BK,mBAAS,CA2BL;AA1BX,mCAQiB;AAmBf,8FA1BA,qBAAa,OA0BA;AACb,2FA1BA,kBAAU,OA0BA;AACV,+FA1BA,sBAAc,OA0BA;AACd,mGA1BA,0BAAkB,OA0BA;AAClB,iGA1BA,wBAAgB,OA0BA;AAChB,mGA1BA,0BAAkB,OA0BA;AAvBpB,kDAA0C;AAwBxC,wFAxBO,sBAAO,OAwBP;AAvBT,2CAA8E;AA0B5E,mGA1BoC,8BAAkB,OA0BpC;AAxBpB,kBAAe;IACb,IAAI,EAAJ,cAAI;IACJ,SAAS,EAAT,mBAAS;IACT,aAAa,EAAb,qBAAa;IACb,UAAU,EAAV,kBAAU;IACV,cAAc,EAAd,sBAAc;IACd,kBAAkB,EAAlB,0BAAkB;IAClB,gBAAgB,EAAhB,wBAAgB;IAChB,kBAAkB,EAAlB,0BAAkB;IAClB,OAAO,EAAP,sBAAO;IACP,kBAAkB,EAAlB,8BAAkB;CACnB,CAAC"} |
| import { html, markdownv, parseEntities, version, SupportedLanguages, } from "./index.js"; | ||
| export default { html, markdownv, parseEntities, version, SupportedLanguages }; | ||
| export { html, markdownv, parseEntities, SupportedLanguages, }; | ||
| //# sourceMappingURL=index.mjs.map |
| {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,OAAO,EAEP,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC/E,OAAO,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EAEb,kBAAkB,GACnB,CAAC"} |
| import type { TypeSupportedLanguages } from "./constants"; | ||
| /** | ||
| * Formats the text as bold using asterisks. | ||
| * @param text - The text to be formatted in bold. | ||
| * @returns The formatted string with bold markdown. | ||
| */ | ||
| declare function bold(text: string): string; | ||
| /** | ||
| * Formats the text as italic using underscores. | ||
| * @param text - The text to be formatted in italics. | ||
| * @returns The formatted string with italic markdown. | ||
| */ | ||
| declare function italic(text: string): string; | ||
| /** | ||
| * Formats the text as underlined using double underscores. | ||
| * @param text - The text to be underlined. | ||
| * @returns The formatted string with underline markdown. | ||
| */ | ||
| declare function underline(text: string): string; | ||
| /** | ||
| * Formats the text as strikethrough using tildes. | ||
| * @param text - The text to be struck through. | ||
| * @returns The formatted string with strikethrough markdown. | ||
| */ | ||
| declare function strikethrough(text: string): string; | ||
| /** | ||
| * Formats the text as a spoiler using double pipes. | ||
| * @param text - The text to be hidden as a spoiler. | ||
| * @returns The formatted string with spoiler markdown. | ||
| */ | ||
| declare function spoiler(text: string): string; | ||
| /** | ||
| * Creates a markdown link with the specified text and URL. | ||
| * @param text - The display text for the link. | ||
| * @param url - The URL to link to. | ||
| * @returns The formatted string with an inline URL. | ||
| */ | ||
| declare function inlineURL(text: string, url: string): string; | ||
| /** | ||
| * Creates an inline mention of a Telegram user by their user ID. | ||
| * @param text - The display text for the mention. | ||
| * @param userId - The Telegram user ID to mention. | ||
| * @returns The formatted string with an inline mention. | ||
| */ | ||
| declare function inlineMention(text: string, userId: string): string; | ||
| /** | ||
| * Inserts an inline emoji using the provided emoji ID. | ||
| * @param emojiId - The ID of the emoji to include. | ||
| * @returns The formatted string with an inline emoji. | ||
| */ | ||
| declare function inlineEmoji(emojiId: string): string; | ||
| /** | ||
| * Formats the text as inline code using backticks. | ||
| * @param text - The text to be formatted as inline code. | ||
| * @returns The formatted string with inline code markdown. | ||
| */ | ||
| declare function inlineCode(text: string): string; | ||
| /** | ||
| * Formats the text as a blockquote using the greater-than symbol. | ||
| * @param text - The text to be formatted as a blockquote. | ||
| * @returns The formatted string with blockquote markdown. | ||
| */ | ||
| declare function blockquote(text: string): string; | ||
| /** | ||
| * Formats the text as an expandable blockquote. | ||
| * @param text - The text to be formatted as an expandable blockquote. | ||
| * @returns The formatted string with expandable blockquote markdown. | ||
| */ | ||
| declare function blockquoteExpandable(text: string): string; | ||
| /** | ||
| * Formats the text as a preformatted code block using triple backticks. | ||
| * @param text - The text to be formatted as a preformatted code block. | ||
| * @returns The formatted string with a preformatted code block. | ||
| */ | ||
| declare function preFormattedCodeBlock(text: string): string; | ||
| /** | ||
| * Formats the text as a preformatted code block with a specified language. | ||
| * @param text - The text to be formatted in a code block. | ||
| * @param language - The programming language of the code block. | ||
| * @returns The formatted string with a language-specific preformatted code block. | ||
| */ | ||
| declare function preFormattedCodeBlockLanguage(text: string, language: TypeSupportedLanguages): string; | ||
| declare const _default: { | ||
| v1: { | ||
| bold: typeof bold; | ||
| italic: typeof italic; | ||
| inlineURL: typeof inlineURL; | ||
| inlineMention: typeof inlineMention; | ||
| inlineCode: typeof inlineCode; | ||
| preFormattedCodeBlock: typeof preFormattedCodeBlock; | ||
| preFormattedCodeBlockLanguage: typeof preFormattedCodeBlockLanguage; | ||
| }; | ||
| bold: typeof bold; | ||
| italic: typeof italic; | ||
| underline: typeof underline; | ||
| strikethrough: typeof strikethrough; | ||
| spoiler: typeof spoiler; | ||
| inlineURL: typeof inlineURL; | ||
| inlineMention: typeof inlineMention; | ||
| inlineEmoji: typeof inlineEmoji; | ||
| inlineCode: typeof inlineCode; | ||
| blockquote: typeof blockquote; | ||
| blockquoteExpandable: typeof blockquoteExpandable; | ||
| preFormattedCodeBlock: typeof preFormattedCodeBlock; | ||
| preFormattedCodeBlockLanguage: typeof preFormattedCodeBlockLanguage; | ||
| }; | ||
| export default _default; | ||
| //# sourceMappingURL=markdownv.d.ts.map |
| {"version":3,"file":"markdownv.d.ts","sourceRoot":"","sources":["../../src/markdownv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;GAIG;AACH,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElC;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED;;;;GAIG;AACH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED;;;;GAIG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErC;AAED;;;;;GAKG;AACH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,iBAAS,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,iBAAS,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;GAKG;AACH,iBAAS,6BAA6B,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,sBAAsB,GAC/B,MAAM,CAER;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAuBE"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** | ||
| * Formats the text as bold using asterisks. | ||
| * @param text - The text to be formatted in bold. | ||
| * @returns The formatted string with bold markdown. | ||
| */ | ||
| function bold(text) { | ||
| return `*${text}*`; | ||
| } | ||
| /** | ||
| * Formats the text as italic using underscores. | ||
| * @param text - The text to be formatted in italics. | ||
| * @returns The formatted string with italic markdown. | ||
| */ | ||
| function italic(text) { | ||
| return `_${text}_`; | ||
| } | ||
| /** | ||
| * Formats the text as underlined using double underscores. | ||
| * @param text - The text to be underlined. | ||
| * @returns The formatted string with underline markdown. | ||
| */ | ||
| function underline(text) { | ||
| return `__${text}__`; | ||
| } | ||
| /** | ||
| * Formats the text as strikethrough using tildes. | ||
| * @param text - The text to be struck through. | ||
| * @returns The formatted string with strikethrough markdown. | ||
| */ | ||
| function strikethrough(text) { | ||
| return `~${text}~`; | ||
| } | ||
| /** | ||
| * Formats the text as a spoiler using double pipes. | ||
| * @param text - The text to be hidden as a spoiler. | ||
| * @returns The formatted string with spoiler markdown. | ||
| */ | ||
| function spoiler(text) { | ||
| return `||${text}||`; | ||
| } | ||
| /** | ||
| * Creates a markdown link with the specified text and URL. | ||
| * @param text - The display text for the link. | ||
| * @param url - The URL to link to. | ||
| * @returns The formatted string with an inline URL. | ||
| */ | ||
| function inlineURL(text, url) { | ||
| return `[${text}](${url})`; | ||
| } | ||
| /** | ||
| * Creates an inline mention of a Telegram user by their user ID. | ||
| * @param text - The display text for the mention. | ||
| * @param userId - The Telegram user ID to mention. | ||
| * @returns The formatted string with an inline mention. | ||
| */ | ||
| function inlineMention(text, userId) { | ||
| return `[${text}](tg://user?id=${userId})`; | ||
| } | ||
| /** | ||
| * Inserts an inline emoji using the provided emoji ID. | ||
| * @param emojiId - The ID of the emoji to include. | ||
| * @returns The formatted string with an inline emoji. | ||
| */ | ||
| function inlineEmoji(emojiId) { | ||
| return ``; | ||
| } | ||
| /** | ||
| * Formats the text as inline code using backticks. | ||
| * @param text - The text to be formatted as inline code. | ||
| * @returns The formatted string with inline code markdown. | ||
| */ | ||
| function inlineCode(text) { | ||
| return `\`${text}\``; | ||
| } | ||
| /** | ||
| * Formats the text as a blockquote using the greater-than symbol. | ||
| * @param text - The text to be formatted as a blockquote. | ||
| * @returns The formatted string with blockquote markdown. | ||
| */ | ||
| function blockquote(text) { | ||
| return `>${text}`; | ||
| } | ||
| /** | ||
| * Formats the text as an expandable blockquote. | ||
| * @param text - The text to be formatted as an expandable blockquote. | ||
| * @returns The formatted string with expandable blockquote markdown. | ||
| */ | ||
| function blockquoteExpandable(text) { | ||
| return `**>${text}`; | ||
| } | ||
| /** | ||
| * Formats the text as a preformatted code block using triple backticks. | ||
| * @param text - The text to be formatted as a preformatted code block. | ||
| * @returns The formatted string with a preformatted code block. | ||
| */ | ||
| function preFormattedCodeBlock(text) { | ||
| return `\`\`\`${text}\`\`\``; | ||
| } | ||
| /** | ||
| * Formats the text as a preformatted code block with a specified language. | ||
| * @param text - The text to be formatted in a code block. | ||
| * @param language - The programming language of the code block. | ||
| * @returns The formatted string with a language-specific preformatted code block. | ||
| */ | ||
| function preFormattedCodeBlockLanguage(text, language) { | ||
| return `\`\`\`${language}\n${text}\n\`\`\``; | ||
| } | ||
| exports.default = { | ||
| v1: { | ||
| bold, | ||
| italic, | ||
| inlineURL, | ||
| inlineMention, | ||
| inlineCode, | ||
| preFormattedCodeBlock, | ||
| preFormattedCodeBlockLanguage, | ||
| }, | ||
| bold, | ||
| italic, | ||
| underline, | ||
| strikethrough, | ||
| spoiler, | ||
| inlineURL, | ||
| inlineMention, | ||
| inlineEmoji, | ||
| inlineCode, | ||
| blockquote, | ||
| blockquoteExpandable, | ||
| preFormattedCodeBlock, | ||
| preFormattedCodeBlockLanguage, | ||
| }; | ||
| //# sourceMappingURL=markdownv.js.map |
| {"version":3,"file":"markdownv.js","sourceRoot":"","sources":["../../src/markdownv.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;AACH,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI,IAAI,GAAG,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,IAAI,GAAG,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,IAAI,GAAG,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,GAAW;IAC1C,OAAO,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,MAAc;IACjD,OAAO,IAAI,IAAI,kBAAkB,MAAM,GAAG,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,uBAAuB,OAAO,GAAG,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,SAAS,IAAI,QAAQ,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAS,6BAA6B,CACpC,IAAY,EACZ,QAAgC;IAEhC,OAAO,SAAS,QAAQ,KAAK,IAAI,UAAU,CAAC;AAC9C,CAAC;AAED,kBAAe;IACb,EAAE,EAAE;QACF,IAAI;QACJ,MAAM;QACN,SAAS;QACT,aAAa;QACb,UAAU;QACV,qBAAqB;QACrB,6BAA6B;KAC9B;IACD,IAAI;IACJ,MAAM;IACN,SAAS;IACT,aAAa;IACb,OAAO;IACP,SAAS;IACT,aAAa;IACb,WAAW;IACX,UAAU;IACV,UAAU;IACV,oBAAoB;IACpB,qBAAqB;IACrB,6BAA6B;CAC9B,CAAC"} |
| export declare namespace MessageEntity { | ||
| interface AbstractMessageEntity { | ||
| /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */ | ||
| type: string; | ||
| /** Offset in UTF-16 code units to the start of the entity */ | ||
| offset: number; | ||
| /** Length of the entity in UTF-16 code units */ | ||
| length: number; | ||
| } | ||
| interface CommonMessageEntity extends AbstractMessageEntity { | ||
| type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "blockquote" | "expandable_blockquote" | "code"; | ||
| } | ||
| interface PreMessageEntity extends AbstractMessageEntity { | ||
| type: "pre"; | ||
| /** For “pre” only, the programming language of the entity text */ | ||
| language?: string; | ||
| } | ||
| interface TextLinkMessageEntity extends AbstractMessageEntity { | ||
| type: "text_link"; | ||
| /** For “text_link” only, URL that will be opened after user taps on the text */ | ||
| url: string; | ||
| } | ||
| interface TextMentionMessageEntity extends AbstractMessageEntity { | ||
| type: "text_mention"; | ||
| /** For “text_mention” only, the mentioned user */ | ||
| user: { | ||
| id: string; | ||
| }; | ||
| } | ||
| interface CustomEmojiMessageEntity extends AbstractMessageEntity { | ||
| type: "custom_emoji"; | ||
| /** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */ | ||
| customEmojiId: string; | ||
| } | ||
| } | ||
| /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */ | ||
| export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity; | ||
| //# sourceMappingURL=type.d.ts.map |
| {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,UAAU,qBAAqB;QAC7B,0pBAA0pB;QAC1pB,IAAI,EAAE,MAAM,CAAC;QACb,6DAA6D;QAC7D,MAAM,EAAE,MAAM,CAAC;QACf,gDAAgD;QAChD,MAAM,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,mBAAoB,SAAQ,qBAAqB;QAChE,IAAI,EACA,SAAS,GACT,SAAS,GACT,SAAS,GACT,aAAa,GACb,KAAK,GACL,OAAO,GACP,cAAc,GACd,MAAM,GACN,QAAQ,GACR,WAAW,GACX,eAAe,GACf,SAAS,GACT,YAAY,GACZ,uBAAuB,GACvB,MAAM,CAAC;KACZ;IACD,UAAiB,gBAAiB,SAAQ,qBAAqB;QAC7D,IAAI,EAAE,KAAK,CAAC;QACZ,kEAAkE;QAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IACD,UAAiB,qBAAsB,SAAQ,qBAAqB;QAClE,IAAI,EAAE,WAAW,CAAC;QAClB,gFAAgF;QAChF,GAAG,EAAE,MAAM,CAAC;KACb;IACD,UAAiB,wBAAyB,SAAQ,qBAAqB;QACrE,IAAI,EAAE,cAAc,CAAC;QACrB,kDAAkD;QAClD,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KACtB;IACD,UAAiB,wBAAyB,SAAQ,qBAAqB;QACrE,IAAI,EAAE,cAAc,CAAC;QACrB,2IAA2I;QAC3I,aAAa,EAAE,MAAM,CAAC;KACvB;CACF;AAED,gHAAgH;AAChH,MAAM,MAAM,aAAa,GACrB,aAAa,CAAC,mBAAmB,GACjC,aAAa,CAAC,wBAAwB,GACtC,aAAa,CAAC,gBAAgB,GAC9B,aAAa,CAAC,qBAAqB,GACnC,aAAa,CAAC,wBAAwB,CAAC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=type.js.map |
| {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":""} |
| import type { MessageEntity } from "./type"; | ||
| import type { ParseMode } from "@telegram.ts/types"; | ||
| /** | ||
| * Defines the types of entities that can be parsed from text. | ||
| */ | ||
| type TypeEntity = "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "blockquote" | "code" | "pre" | "text_link" | "text_mention" | "custom_emoji"; | ||
| /** | ||
| * Patterns used to match HTML entities in the text. | ||
| */ | ||
| declare const htmlEntityPatterns: Record<string, RegExp>; | ||
| /** | ||
| * Patterns used to match Markdown entities in the text. | ||
| */ | ||
| declare const markdownPatterns: Record<string, RegExp>; | ||
| /** | ||
| * Patterns used to match MarkdownV2 entities in the text. | ||
| */ | ||
| declare const markdownV2Patterns: Record<string, RegExp>; | ||
| /** | ||
| * Parses text to extract entities based on the specified format. | ||
| * @param text - The text to parse for entities. | ||
| * @param format - The format of the text, either "HTML", "Markdown", or "MarkdownV2". | ||
| * @returns An array of MessageEntity objects representing the parsed entities. | ||
| */ | ||
| declare function parseEntities(text: string, format: ParseMode): MessageEntity[]; | ||
| /** | ||
| * Escapes HTML special characters in a string. | ||
| * @param content - The content to escape. | ||
| * @returns The escaped string. | ||
| */ | ||
| declare function escapeHTML(content: string): string; | ||
| /** | ||
| * Escapes Markdown special characters in a string. | ||
| * @param content - The content to escape. | ||
| * @returns The escaped string. | ||
| */ | ||
| declare function escapeMarkdown(content: string): string; | ||
| export { parseEntities, escapeHTML, escapeMarkdown, htmlEntityPatterns, markdownPatterns, markdownV2Patterns, type TypeEntity, }; | ||
| //# sourceMappingURL=utils.d.ts.map |
| {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,KAAK,UAAU,GACX,SAAS,GACT,SAAS,GACT,SAAS,GACT,aAAa,GACb,KAAK,GACL,OAAO,GACP,cAAc,GACd,MAAM,GACN,QAAQ,GACR,WAAW,GACX,eAAe,GACf,SAAS,GACT,YAAY,GACZ,MAAM,GACN,KAAK,GACL,WAAW,GACX,cAAc,GACd,cAAc,CAAC;AAEnB;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY9C,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO5C,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK9C,CAAC;AAEF;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,aAAa,EAAE,CA6DvE;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ3C;AAED;;;;GAIG;AACH,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0B/C;AAED,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,UAAU,GAChB,CAAC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.markdownV2Patterns = exports.markdownPatterns = exports.htmlEntityPatterns = void 0; | ||
| exports.parseEntities = parseEntities; | ||
| exports.escapeHTML = escapeHTML; | ||
| exports.escapeMarkdown = escapeMarkdown; | ||
| /** | ||
| * Patterns used to match HTML entities in the text. | ||
| */ | ||
| const htmlEntityPatterns = { | ||
| bold: /<b>(.*?)<\/b>|<strong>(.*?)<\/strong>/g, | ||
| italic: /<i>(.*?)<\/i>|<em>(.*?)<\/em>/g, | ||
| underline: /<u>(.*?)<\/u>|<ins>(.*?)<\/ins>/g, | ||
| strikethrough: /<s>(.*?)<\/s>|<strike>(.*?)<\/strike>|<del>(.*?)<\/del>/g, | ||
| spoiler: /<span class="tg-spoiler">(.*?)<\/span>/g, | ||
| text_link: /<a href="([^"]+)">(.*?)<\/a>/g, | ||
| text_mention: /<a href="tg:\/\/user\?id=(\d+)">(.*?)<\/a>/g, | ||
| custom_emoji: /<tg-emoji emoji-id="([^"]+)">(.*?)<\/tg-emoji>/g, | ||
| code: /<code>(.*?)<\/code>/g, | ||
| pre: /<pre>(.*?)<\/pre>/g, | ||
| blockquote: /<blockquote>(.*?)<\/blockquote>/g, | ||
| }; | ||
| exports.htmlEntityPatterns = htmlEntityPatterns; | ||
| /** | ||
| * Patterns used to match Markdown entities in the text. | ||
| */ | ||
| const markdownPatterns = { | ||
| bold: /\*([^\*]+)\*/g, | ||
| italic: /_([^_]+)_/g, | ||
| text_link: /\[([^\]]+)\]\((http[^\)]+)\)/g, | ||
| text_mention: /\[([^\]]+)\]\((tg:\/\/user\?id=\d+)\)/g, | ||
| code: /`([^`]+)`/g, | ||
| pre: /```([a-zA-Z]*)\n([\s\S]*?)```/g, | ||
| }; | ||
| exports.markdownPatterns = markdownPatterns; | ||
| /** | ||
| * Patterns used to match MarkdownV2 entities in the text. | ||
| */ | ||
| const markdownV2Patterns = { | ||
| ...markdownPatterns, | ||
| underline: /__([^_]+)__/g, | ||
| strikethrough: /~([^~]+)~/g, | ||
| spoiler: /\|\|([^|]+)\|\|/g, | ||
| }; | ||
| exports.markdownV2Patterns = markdownV2Patterns; | ||
| /** | ||
| * Parses text to extract entities based on the specified format. | ||
| * @param text - The text to parse for entities. | ||
| * @param format - The format of the text, either "HTML", "Markdown", or "MarkdownV2". | ||
| * @returns An array of MessageEntity objects representing the parsed entities. | ||
| */ | ||
| function parseEntities(text, format) { | ||
| var _a, _b, _c; | ||
| const entities = []; | ||
| /** | ||
| * Adds an entity to the list of parsed entities. | ||
| * @param type - The type of the entity. | ||
| * @param offset - The offset of the entity in the text. | ||
| * @param length - The length of the entity in the text. | ||
| * @param extra - Additional properties specific to the entity type. | ||
| */ | ||
| function addEntity(type, offset, length, extra = {}) { | ||
| const entity = { type, offset, length, ...extra }; | ||
| entities.push(entity); | ||
| } | ||
| const entityPatterns = format === "HTML" | ||
| ? htmlEntityPatterns | ||
| : format === "MarkdownV2" | ||
| ? markdownV2Patterns | ||
| : markdownPatterns; | ||
| for (const [type, regex] of Object.entries(entityPatterns)) { | ||
| let match; | ||
| while ((match = regex.exec(text)) !== null) { | ||
| const [fullMatch, ...groups] = match; | ||
| const offset = match.index; | ||
| const length = fullMatch.length; | ||
| if (type === "text_link") { | ||
| const url = format === "HTML" ? groups[0] : groups[1]; | ||
| addEntity("text_link", offset, length, { url: url !== null && url !== void 0 ? url : "" }); | ||
| } | ||
| else if (type === "text_mention") { | ||
| addEntity("text_mention", offset, length, { | ||
| user: { id: (_a = groups[0]) !== null && _a !== void 0 ? _a : "0" }, | ||
| }); | ||
| } | ||
| else if (type === "custom_emoji") { | ||
| const customEmojiId = (_b = groups[0]) !== null && _b !== void 0 ? _b : ""; | ||
| addEntity("custom_emoji", offset, length, { | ||
| customEmojiId: customEmojiId, | ||
| }); | ||
| } | ||
| else if (type === "pre" && format === "MarkdownV2") { | ||
| const language = (_c = groups[0]) !== null && _c !== void 0 ? _c : ""; | ||
| addEntity("pre", offset, length, { language }); | ||
| } | ||
| else { | ||
| addEntity(type, offset, length); | ||
| } | ||
| } | ||
| } | ||
| return entities.sort((a, b) => a.offset - b.offset); | ||
| } | ||
| /** | ||
| * Escapes HTML special characters in a string. | ||
| * @param content - The content to escape. | ||
| * @returns The escaped string. | ||
| */ | ||
| function escapeHTML(content) { | ||
| const escapables = { | ||
| "<": "<", | ||
| ">": ">", | ||
| "&": "&", | ||
| }; | ||
| return content.replace(/[<>&]/g, (char) => { var _a; return (_a = escapables[char]) !== null && _a !== void 0 ? _a : char; }); | ||
| } | ||
| /** | ||
| * Escapes Markdown special characters in a string. | ||
| * @param content - The content to escape. | ||
| * @returns The escaped string. | ||
| */ | ||
| function escapeMarkdown(content) { | ||
| const escapables = { | ||
| _: "\\_", | ||
| "*": "\\*", | ||
| "[": "\\[", | ||
| "]": "\\]", | ||
| "(": "\\(", | ||
| ")": "\\)", | ||
| "~": "\\~", | ||
| "`": "\\`", | ||
| ">": "\\>", | ||
| "#": "\\#", | ||
| "+": "\\+", | ||
| "-": "\\-", | ||
| "=": "\\=", | ||
| "|": "\\|", | ||
| "{": "\\{", | ||
| "}": "\\}", | ||
| ".": "\\.", | ||
| "!": "\\!", | ||
| }; | ||
| return content.replace(/[_*\[\]()~`>#\+\-=|{}.!]/g, (char) => { var _a; return (_a = escapables[char]) !== null && _a !== void 0 ? _a : char; }); | ||
| } | ||
| //# sourceMappingURL=utils.js.map |
| {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAuLE,sCAAa;AACb,gCAAU;AACV,wCAAc;AA/JhB;;GAEG;AACH,MAAM,kBAAkB,GAA2B;IACjD,IAAI,EAAE,wCAAwC;IAC9C,MAAM,EAAE,gCAAgC;IACxC,SAAS,EAAE,kCAAkC;IAC7C,aAAa,EAAE,0DAA0D;IACzE,OAAO,EAAE,yCAAyC;IAClD,SAAS,EAAE,+BAA+B;IAC1C,YAAY,EAAE,6CAA6C;IAC3D,YAAY,EAAE,iDAAiD;IAC/D,IAAI,EAAE,sBAAsB;IAC5B,GAAG,EAAE,oBAAoB;IACzB,UAAU,EAAE,kCAAkC;CAC/C,CAAC;AAiJA,gDAAkB;AA/IpB;;GAEG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,+BAA+B;IAC1C,YAAY,EAAE,wCAAwC;IACtD,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,gCAA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AAM;QACX,GAAG,EAAE,OAAO;KACb,CAAC;IAEF,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,MAAA,UAAU,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAA,EAAA,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,UAAU,GAA2B;QACzC,CAAC,EAAE,KAAK;QACR,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;KACX,CAAC;IAEF,OAAO,OAAO,CAAC,OAAO,CACpB,2BAA2B,EAC3B,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,MAAA,UAAU,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAA,EAAA,CACnC,CAAC;AACJ,CAAC"} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
450
625.81%1
-66.67%37643
-64.68%1
Infinity%3
50%18
-43.75%574
-67.03%1
Infinity%+ Added
+ Added