-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8e0d10
commit df00864
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package tdproto | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
const ( | ||
Bold = "bold" | ||
Italic = "italic" | ||
Underscore = "underscore" | ||
Strike = "strike" | ||
Code = "code" | ||
CodeBlock = "codeblock" | ||
Quote = "quote" | ||
Link = "link" | ||
) | ||
|
||
// Markup entity. Experimental | ||
type MarkupEntity struct { | ||
// Open marker offset | ||
Open int `json:"open"` | ||
|
||
// Open marker length | ||
OpenLength int `json:"open_length,omitempty"` | ||
|
||
// Close marker offset | ||
Close int `json:"close"` | ||
|
||
// Close marker length | ||
CloseLength int `json:"close_length,omitempty"` | ||
|
||
// Marker type | ||
Type string `json:"type"` | ||
|
||
// Link, if any | ||
Url string `json:"url,omitempty"` | ||
|
||
// List of internal markup entities | ||
Entities []MarkupEntity `json:"entities,omitempty"` | ||
} | ||
|
||
func (e MarkupEntity) String() string { | ||
return fmt.Sprintf("%d..+%d %d..+%d %s", e.Open, e.OpenLength, e.Close, e.CloseLength, e.Type) | ||
} |