Add some other message parts as demo.

This commit is contained in:
Danila Fedorin 2021-07-01 00:19:01 -07:00
parent ad868818c7
commit fd12baae3b

View file

@ -36,8 +36,46 @@ export function stringAsBody(body) {
return new MessageBody(body, [new TextPart(body)]); return new MessageBody(body, [new TextPart(body)]);
} }
class HeaderBlock {
constructor(level, inlines) {
this.level = level;
this.inlines = inlines;
}
get type() { return "header"; }
isBlock() { return true; }
}
class CodeBlock {
constructor(text) {
this.text = text;
}
get type() { return "codeblock"; }
isBlock() { return true; }
}
class NewLinePart { class NewLinePart {
get type() { return "newline"; } get type() { return "newline"; }
isBlock() { return false; }
}
class EmphPart {
constructor(wraps) {
this.wraps = wraps;
}
get type() { return "emph"; }
isBlock() { return false; }
}
class CodePart {
constructor(wraps) {
this.wraps = wraps;
}
get type() { return "code"; }
isBlock() { return false; }
} }
class LinkPart { class LinkPart {
@ -47,6 +85,7 @@ class LinkPart {
} }
get type() { return "link"; } get type() { return "link"; }
isBlock() { return false; }
} }
class TextPart { class TextPart {
@ -55,6 +94,7 @@ class TextPart {
} }
get type() { return "text"; } get type() { return "text"; }
isBlock() { return false; }
} }
class MessageBody { class MessageBody {