Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - func Digits(num int) int
 - func Parse(ctx context.Context, parser *HTMLParser, content *event.MessageEventContent) (string, []*signalpb.BodyRange)
 - type Context
 - type EntityString
 - func (es *EntityString) Append(other *EntityString) *EntityString
 - func (es *EntityString) AppendString(other string) *EntityString
 - func (es *EntityString) Format(value signalfmt.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, []*signalpb.BodyRange)
Types ¶
type Context ¶
type Context struct {
	Ctx                context.Context
	AllowedMentions    *event.Mentions
	TagStack           TagStack
	PreserveWhitespace bool
}
    func NewContext ¶
func (Context) WithWhitespace ¶
type EntityString ¶
type EntityString struct {
	String   signalfmt.UTF16String
	Entities signalfmt.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 signalfmt.BodyRangeValue) *EntityString
func (*EntityString) Split ¶
func (es *EntityString) Split(at uint16) []*EntityString
func (*EntityString) TrimSpace ¶
func (es *EntityString) TrimSpace() *EntityString
type HTMLParser ¶
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.