discord2html 1.0.2 → 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/dist/index.mjs CHANGED
@@ -128766,7 +128766,7 @@ import { ChannelType as ChannelType2 } from "discord.js";
128766
128766
 
128767
128767
  // src/generator/renderers/content.tsx
128768
128768
  var import_react = __toESM(require_react());
128769
- import parse from "discord-markdown-parser";
128769
+ import { parse } from "discord-markdown-parser";
128770
128770
  import { ChannelType } from "discord.js";
128771
128771
 
128772
128772
  // src/utils/utils.ts
@@ -128897,6 +128897,18 @@ async function MessageSingleASTNode({ node, context }) {
128897
128897
  );
128898
128898
  case "timestamp":
128899
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 }));
128900
128912
  default: {
128901
128913
  console.log(`Unknown node type: ${type}`, node);
128902
128914
  return typeof node.content === "string" ? node.content : /* @__PURE__ */ import_react.default.createElement(MessageASTNodes, { nodes: node.content, context });