Skip to content

Instantly share code, notes, and snippets.

@brecert
Created October 15, 2021 00:18
Show Gist options
  • Save brecert/40397874f308a8c2e80a737d430facc6 to your computer and use it in GitHub Desktop.
Save brecert/40397874f308a8c2e80a737d430facc6 to your computer and use it in GitHub Desktop.
bitflag TextFormatting: u8 {
BOLD,
ITLALIC,
MONOSPACE,
UNDERLINE,
STRIKETHROUGH,
SPOILER
}
enum TextEntity {
Text
Emoji
Code { syn: TextSpan }
Link { uri: TextSpan }
}
struct TextEntity {
type: TextEntity
text: TextSpan
full_span: TextSpan
formatting: TextFormatting
entities: Vec<TextEntity>
}
enum MessageEntity {
Text { entities: Vec<TextEntity> },
Expr { type: TextSpan, expr: TextSpan, full_span: TextSpan },
Image { uri: TextSpan, alt: Option<TextSpan> },
Blockquote { entities: Vec<TextEntity> }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment