Skip to content

Commit

Permalink
MarkupEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed Oct 18, 2020
1 parent e8e0d10 commit df00864
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions markup_entity.go
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)
}

0 comments on commit df00864

Please sign in to comment.