md

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InlineEmojiSize = 22
	LargeEmojiSize  = 48
)

Variables

View Source
var (
	ChannelPressed func(ev PressedEvent, ch *discord.Channel)
	UserPressed    func(ev PressedEvent, user *discord.GuildUser)
)
View Source
var EmptyTag = Tag{}

Functions

func AttrMarkup added in v0.0.4

func AttrMarkup(a md.Attribute) string

func ChangeStyle

func ChangeStyle(styleName string) error

func ColorTag

func ColorTag(table *gtk.TextTagTable, attr md.Attribute, color string) *gtk.TextTag

func EmojiURL

func EmojiURL(emojiID string, animated bool) string

func Parse

func Parse(content []byte, dst *gtk.TextView, opts ...parser.ParseOption)

func ParseMessageContent

func ParseMessageContent(dst *gtk.TextView, s *ningen.State, m *discord.Message)

func ParseToMarkup

func ParseToMarkup(content []byte) []byte

func ParseToMarkupWithMessage

func ParseToMarkupWithMessage(content []byte, s store.Cabinet, m *discord.Message) []byte

func ParseToSimpleMarkupWithMessage

func ParseToSimpleMarkupWithMessage(content []byte, s store.Cabinet, m *discord.Message) []byte

func ParseWithMessage

func ParseWithMessage(content []byte, dst *gtk.TextView, s *ningen.State, m *discord.Message)

func WrapTag added in v0.0.4

func WrapTag(tv *gtk.TextView, props map[string]interface{})

Types

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter that generates Pango markup.

func (*Formatter) Format

func (f *Formatter) Format(r *Renderer, iterator chroma.Iterator)

type MarkupRenderer

type MarkupRenderer struct {
	// contains filtered or unexported fields
}

func NewMarkupRenderer

func NewMarkupRenderer() *MarkupRenderer

func (*MarkupRenderer) Render

func (r *MarkupRenderer) Render(w io.Writer, source []byte, n ast.Node) error

type PressedEvent

type PressedEvent struct {
	*gdk.EventButton
	TextView *gtk.TextView
}

type Renderer

type Renderer struct {
	View   *gtk.TextView
	Buffer *gtk.TextBuffer
	// contains filtered or unexported fields
}

Render is a non-thread-safe TextBuffer renderer.

func NewRenderer

func NewRenderer(tv *gtk.TextView) *Renderer

func (*Renderer) AddOptions

func (r *Renderer) AddOptions(...renderer.Option)

AddOptions is a noop.

func (*Renderer) Render

func (r *Renderer) Render(_ io.Writer, source []byte, n ast.Node) error

type SimpleMarkupRenderer

type SimpleMarkupRenderer struct {
	MarkupRenderer
}

func NewSimpleMarkupRenderer

func NewSimpleMarkupRenderer() *SimpleMarkupRenderer

func (*SimpleMarkupRenderer) Render

func (r *SimpleMarkupRenderer) Render(w io.Writer, source []byte, n ast.Node) error

type Tag

type Tag struct {
	Attr  md.Attribute
	Color string
}

func (Tag) Combine

func (t Tag) Combine(tag Tag) Tag

type TagState

type TagState struct {
	Tag
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL