@discord/markdown-types 0.1.2 → 0.1.4
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/index.d.ts +75 -43
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export type Node<T, V> = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type: T;
|
|
3
|
+
value: V;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
export type EmptyNode<T> = { type: T; value?: never };
|
|
7
7
|
|
|
8
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
8
9
|
export type AnyNode<T = any, V = any> = Node<T, V> | EmptyNode<T>;
|
|
9
10
|
|
|
10
11
|
// base
|
|
@@ -20,80 +21,111 @@ export type Italic = Node<"italic", Inline[]>;
|
|
|
20
21
|
export type Bold = Node<"bold", Inline[]>;
|
|
21
22
|
|
|
22
23
|
export type NormalLink = Node<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
"normal",
|
|
25
|
+
{
|
|
26
|
+
text?: Exclude<Inline, Link>[];
|
|
27
|
+
url: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
}
|
|
29
30
|
>;
|
|
30
31
|
|
|
31
|
-
export type
|
|
32
|
+
export type ChannelMentionLink = Node<
|
|
33
|
+
"channel",
|
|
34
|
+
{
|
|
35
|
+
guild_id: string | "@me";
|
|
36
|
+
channel_id: string;
|
|
37
|
+
}
|
|
38
|
+
>;
|
|
39
|
+
export type MessageMentionLink = Node<
|
|
40
|
+
"message",
|
|
41
|
+
{
|
|
42
|
+
guild_id: string | "@me";
|
|
43
|
+
channel_id: string;
|
|
44
|
+
message_id: string;
|
|
45
|
+
}
|
|
46
|
+
>;
|
|
47
|
+
export type AttachmentMentionLink = Node<
|
|
48
|
+
"attachment",
|
|
49
|
+
{
|
|
50
|
+
channel_id: string;
|
|
51
|
+
attachment_id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
>;
|
|
55
|
+
export type MentionLink = Node<
|
|
56
|
+
"mention",
|
|
57
|
+
ChannelMentionLink | MessageMentionLink | AttachmentMentionLink
|
|
58
|
+
>;
|
|
32
59
|
|
|
33
60
|
export type Link = Node<"link", NormalLink | MentionLink>;
|
|
34
61
|
|
|
35
62
|
export type UserMention = Node<"user", string>;
|
|
36
63
|
export type ChannelMention = Node<"channel", string>;
|
|
37
64
|
export type RoleMention = Node<"role", string>;
|
|
65
|
+
export type GameMention = Node<"game", string>;
|
|
38
66
|
export type CommandMention = Node<"command", { name: string; id: string }>;
|
|
39
67
|
export type EveryoneMention = EmptyNode<"everyone">;
|
|
40
68
|
export type HereMention = EmptyNode<"here">;
|
|
41
69
|
export type Mention = Node<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
"mention",
|
|
71
|
+
| UserMention
|
|
72
|
+
| ChannelMention
|
|
73
|
+
| RoleMention
|
|
74
|
+
| GameMention
|
|
75
|
+
| CommandMention
|
|
76
|
+
| EveryoneMention
|
|
77
|
+
| HereMention
|
|
49
78
|
>;
|
|
50
79
|
|
|
51
80
|
export type Timestamp = Node<"timestamp", { value: string; style?: string }>;
|
|
52
81
|
|
|
53
82
|
export type CustomEmoji = Node<
|
|
54
|
-
|
|
55
|
-
|
|
83
|
+
"custom",
|
|
84
|
+
{ animated: boolean; name: string; id: string }
|
|
56
85
|
>;
|
|
57
86
|
export type UnicodeEmoji = Node<"unicode", string>;
|
|
58
87
|
export type Emoji = Node<"emoji", CustomEmoji | UnicodeEmoji>;
|
|
59
88
|
|
|
60
89
|
export type CodeBlock = Node<
|
|
61
|
-
|
|
62
|
-
|
|
90
|
+
"code_block",
|
|
91
|
+
{ language?: string; content: string }
|
|
63
92
|
>;
|
|
64
93
|
|
|
65
94
|
export type Inline =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
95
|
+
| Bold
|
|
96
|
+
| Code
|
|
97
|
+
| CodeBlock
|
|
98
|
+
| Emoji
|
|
99
|
+
| Italic
|
|
100
|
+
| Link
|
|
101
|
+
| Mention
|
|
102
|
+
| Spoiler
|
|
103
|
+
| Strikethrough
|
|
104
|
+
| Timestamp
|
|
105
|
+
| Underline;
|
|
77
106
|
|
|
78
107
|
export type Heading = Node<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
108
|
+
"heading",
|
|
109
|
+
{
|
|
110
|
+
level: number;
|
|
111
|
+
content: Inline[];
|
|
112
|
+
}
|
|
84
113
|
>;
|
|
85
114
|
|
|
86
115
|
export type ListItem = { content: (List | Paragraph)[] };
|
|
87
116
|
export type List = Node<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
"list",
|
|
118
|
+
{
|
|
119
|
+
type: "unordered" | "ordered";
|
|
120
|
+
value?: number;
|
|
121
|
+
items: ListItem[];
|
|
122
|
+
}
|
|
94
123
|
>;
|
|
95
124
|
export type Empty = EmptyNode<"empty">;
|
|
96
125
|
export type Quote = Node<"quote", Block[]>;
|
|
97
126
|
export type Small = Node<"small", { content: Inline[] }>;
|
|
98
127
|
|
|
99
|
-
export type Block = Heading | List | Quote | Small;
|
|
128
|
+
export type Block = Empty | Heading | List | Quote | Small;
|
|
129
|
+
|
|
130
|
+
export type NodeType = Inline["type"] | Block["type"];
|
|
131
|
+
export type Rule = Exclude<NodeType, "paragraph" | "text" | "empty">;
|