discord2html 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{chunk-I5MJAEQ5.mjs → chunk-7ZTHJQTL.mjs} +2 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{lib-4JGP6V5E.mjs → lib-XLT2PDZN.mjs} +3 -2
- package/dist/{lib-4JGP6V5E.mjs.map → lib-XLT2PDZN.mjs.map} +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-I5MJAEQ5.mjs.map → chunk-7ZTHJQTL.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire as __td_createRequire } from 'module'; const require = __td_createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
__commonJS,
|
|
3
4
|
__esm,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
__require,
|
|
7
8
|
__toCommonJS,
|
|
8
9
|
__toESM
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7ZTHJQTL.mjs";
|
|
10
11
|
|
|
11
12
|
// node_modules/react/cjs/react.production.js
|
|
12
13
|
var require_react_production = __commonJS({
|
|
@@ -128765,7 +128766,7 @@ import { ChannelType as ChannelType2 } from "discord.js";
|
|
|
128765
128766
|
|
|
128766
128767
|
// src/generator/renderers/content.tsx
|
|
128767
128768
|
var import_react = __toESM(require_react());
|
|
128768
|
-
import parse from "discord-markdown-parser";
|
|
128769
|
+
import { parse } from "discord-markdown-parser";
|
|
128769
128770
|
import { ChannelType } from "discord.js";
|
|
128770
128771
|
|
|
128771
128772
|
// src/utils/utils.ts
|
|
@@ -128896,6 +128897,18 @@ async function MessageSingleASTNode({ node, context }) {
|
|
|
128896
128897
|
);
|
|
128897
128898
|
case "timestamp":
|
|
128898
128899
|
return /* @__PURE__ */ import_react.default.createElement(DiscordTime, { timestamp: parseInt(node.timestamp) * 1e3, format: node.format });
|
|
128900
|
+
// Discord Components V2 / modern markdown: headings (#, ##, ###) and subtext (-#).
|
|
128901
|
+
case "heading": {
|
|
128902
|
+
if (context.type === 1 /* REPLY */) {
|
|
128903
|
+
return /* @__PURE__ */ import_react.default.createElement(MessageASTNodes, { nodes: node.content, context });
|
|
128904
|
+
}
|
|
128905
|
+
const level = Math.min(Math.max(Number(node.level) || 1, 1), 3);
|
|
128906
|
+
const fontSize = level === 1 ? "1.5em" : level === 2 ? "1.25em" : "1.1em";
|
|
128907
|
+
const Tag = `h${level}`;
|
|
128908
|
+
return /* @__PURE__ */ import_react.default.createElement(Tag, { style: { margin: "8px 0 4px", fontWeight: 700, lineHeight: 1.25, fontSize } }, /* @__PURE__ */ import_react.default.createElement(MessageASTNodes, { nodes: node.content, context }));
|
|
128909
|
+
}
|
|
128910
|
+
case "subtext":
|
|
128911
|
+
return /* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: "0.8em", color: "var(--text-muted, #949ba4)" } }, /* @__PURE__ */ import_react.default.createElement(MessageASTNodes, { nodes: node.content, context }));
|
|
128899
128912
|
default: {
|
|
128900
128913
|
console.log(`Unknown node type: ${type}`, node);
|
|
128901
128914
|
return typeof node.content === "string" ? node.content : /* @__PURE__ */ import_react.default.createElement(MessageASTNodes, { nodes: node.content, context });
|
|
@@ -129912,7 +129925,7 @@ var _TranscriptImageDownloader = class _TranscriptImageDownloader {
|
|
|
129912
129925
|
*/
|
|
129913
129926
|
withCompression(quality = 80, convertToWebP = false, options = {}) {
|
|
129914
129927
|
if (quality < 1 || quality > 100) throw new Error("Quality must be between 1 and 100");
|
|
129915
|
-
import("./lib-
|
|
129928
|
+
import("./lib-XLT2PDZN.mjs").catch((err) => {
|
|
129916
129929
|
console.error(err);
|
|
129917
129930
|
console.error(
|
|
129918
129931
|
`[discord2html] Failed to import 'sharp'. Image compression requires the 'sharp' package to be installed. Either install sharp or remove the compression options.`
|
|
@@ -129938,7 +129951,7 @@ var _TranscriptImageDownloader = class _TranscriptImageDownloader {
|
|
|
129938
129951
|
const buffer = await response.body.arrayBuffer().then((res) => Buffer.from(res));
|
|
129939
129952
|
this.log(`Finished fetching ${attachment.id} (${buffer.length} bytes)`);
|
|
129940
129953
|
if (this.compression) {
|
|
129941
|
-
const sharp = await import("./lib-
|
|
129954
|
+
const sharp = await import("./lib-XLT2PDZN.mjs");
|
|
129942
129955
|
this.log(`Compressing ${attachment.id} with 'sharp'`);
|
|
129943
129956
|
const sharpbuf = await sharp.default(buffer).webp({
|
|
129944
129957
|
quality: this.compression.quality,
|