mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
fix(telegram): render HTML with markdown-it and strip HTML from Discord bodies
This commit is contained in:
7 files changed
+90
-18
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import type { NeutralMessage, NeutralAuthor } from "../types";
|
||||
import { GITHUB_COLORS } from "./colors";
|
||||
import { cap, emojiPrefix, MAX_FIELD_VALUE, type T, buildMessage } from "./helpers";
|
||||
import { cap, emojiPrefix, htmlToText, MAX_FIELD_VALUE, type T, buildMessage } from "./helpers";
|
||||
|
||||
export function formatIssues(
|
||||
payload: Record<string, unknown>,
|
||||
@@ -38,7 +38,7 @@ export function formatIssues(
|
||||
descriptionParts.push(t("events.issues.action_issue", { emoji: em(stateEmoji), action: al }));
|
||||
|
||||
if (issue.body) {
|
||||
const truncated = issue.body.slice(0, 300);
|
||||
const truncated = htmlToText(issue.body).slice(0, 300);
|
||||
descriptionParts.push(`\n${truncated}${issue.body.length > 300 ? "..." : ""}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
branchLink,
|
||||
cap,
|
||||
emojiPrefix,
|
||||
htmlToText,
|
||||
MAX_FIELD_VALUE,
|
||||
type T,
|
||||
buildMessage,
|
||||
@@ -58,7 +59,7 @@ export function formatPullRequest(
|
||||
descriptionParts.push(t("events.pr.action_pr", { emoji: em(stateEmoji), action: al }));
|
||||
|
||||
if (pr.body) {
|
||||
const truncated = pr.body.slice(0, 300);
|
||||
const truncated = htmlToText(pr.body).slice(0, 300);
|
||||
descriptionParts.push(`\n${truncated}${pr.body.length > 300 ? "..." : ""}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user