Documentation ¶
Index ¶
- Variables
- func Digits(num int) int
- func Parse(ctx context.Context, parser *HTMLParser, content *event.MessageEventContent) (string, []tg.MessageEntityClass)
- type Context
- type EntityString
- func (es *EntityString) Append(other *EntityString) *EntityString
- func (es *EntityString) AppendString(other string) *EntityString
- func (es *EntityString) Format(value telegramfmt.BodyRangeValue) *EntityString
- func (es *EntityString) Split(at uint16) []*EntityString
- func (es *EntityString) TrimSpace() *EntityString
- type HTMLParser
- type TagStack
- type TaggedString
Constants ¶
This section is empty.
Variables ¶
View Source
var BlockTags = []string{"p", "h1", "h2", "h3", "h4", "h5", "h6", "ol", "ul", "pre", "blockquote", "div", "hr", "table"}
View Source
var DebugLog = func(format string, args ...any) {}
Functions ¶
func Parse ¶
func Parse(ctx context.Context, parser *HTMLParser, content *event.MessageEventContent) (string, []tg.MessageEntityClass)
Types ¶
type Context ¶
type Context struct { Ctx context.Context AllowedMentions *event.Mentions TagStack TagStack PreserveWhitespace bool ListDepth int }
func NewContext ¶
func (Context) WithIncrementedListDepth ¶
func (Context) WithWhitespace ¶
type EntityString ¶
type EntityString struct { String telegramfmt.UTF16String Entities telegramfmt.BodyRangeList }
func JoinEntityString ¶
func JoinEntityString(with string, strings ...*EntityString) *EntityString
func NewEntityString ¶
func NewEntityString(val string) *EntityString
func (*EntityString) Append ¶
func (es *EntityString) Append(other *EntityString) *EntityString
func (*EntityString) AppendString ¶
func (es *EntityString) AppendString(other string) *EntityString
func (*EntityString) Format ¶
func (es *EntityString) Format(value telegramfmt.BodyRangeValue) *EntityString
func (*EntityString) Split ¶
func (es *EntityString) Split(at uint16) []*EntityString
func (*EntityString) TrimSpace ¶
func (es *EntityString) TrimSpace() *EntityString
type HTMLParser ¶
type HTMLParser struct {
GetGhostDetails func(context.Context, id.UserID) (networkid.UserID, string, int64, bool)
}
HTMLParser is a somewhat customizable Matrix HTML parser.
func (*HTMLParser) Parse ¶
func (parser *HTMLParser) Parse(htmlData string, ctx Context) *EntityString
Parse converts Matrix HTML into text using the settings in this parser.
type TaggedString ¶
type TaggedString struct { *EntityString // contains filtered or unexported fields }
TaggedString is a string that also contains a HTML tag.
Click to show internal directories.
Click to hide internal directories.