renderer

package
v0.0.0-...-bc91aa5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeTypeNone        = "none"
	NodeTypeBlockquote  = "blockquote"
	NodeTypeBulletList  = "bulletList"
	NodeTypeCodeBlock   = "codeBlock"
	NodeTypeHeading     = "heading"
	NodeTypeMediaGroup  = "mediaGroup"
	NodeTypeMediaSingle = "mediaSingle"
	NodeTypeOrderedList = "orderedList"
	NodeTypePanel       = "panel"
	NodeTypeParagraph   = "paragraph"
	NodeTypeRule        = "rule"
	NodeTypeTable       = "table"
	NodeTypeListItem    = "listItem"
	NodeTypeMedia       = "media"
	NodeTypeTableCell   = "table_cell"
	NodeTypeTableHeader = "table_header"
	NodeTypeTableRow    = "table_row"
	NodeTypeEmoji       = "emoji"
	NodeTypeHardBreak   = "hardBreak"
	NodeTypeInlineCard  = "inlineCard"
	NodeTypeMention     = "mention"
	NodeTypeText        = "text"
)

Node types

View Source
const (
	LayoutWrapLeft   = "wrap-left"
	LayoutCenter     = "center"
	LayoutWrapRight  = "wrap-right"
	LayoutWide       = "wide"
	LayoutFullWidth  = "full-width"
	LayoutAlignStart = "align-start"
	LayoutAlignEnd   = "align-end"
)

Enum values for Layout in Attributes struct

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, source []byte) error

Types

type ADFRenderer

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

ADFRenderer implements goldmark.Renderer

func NewRenderer

func NewRenderer() *ADFRenderer

func (*ADFRenderer) AddOptions

func (*ADFRenderer) AddOptions(...renderer.Option)

func (*ADFRenderer) Render

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

Render implements goldmark.Renderer interface.

type Attributes

type Attributes struct {
	Width    float32 `json:"width,omitempty"`    // For media single
	Layout   Layout  `json:"layout,omitempty"`   // For media single
	Level    int     `json:"level,omitempty"`    // For headings
	Language string  `json:"language,omitempty"` // For fenced code blocks
}

type Layout

type Layout string

type Mark

type Mark string

Mark represents a text formatting directive

const (
	MarkCode      Mark = "code"
	MarkEm        Mark = "em"
	MarkLink      Mark = "link"
	MarkStrike    Mark = "strike"
	MarkStrong    Mark = "strong"
	MarkSubsup    Mark = "subsup"
	MarkTextcolor Mark = "textColor"
	MarkUnderline Mark = "underline"
)

Enum values for Mark text formatting

type MarkAttributes

type MarkAttributes struct {
	Href  string `json:"href,omitempty"`  // For links
	Title string `json:"title,omitempty"` // For links
}

type MarkStruct

type MarkStruct struct {
	Type       Mark            `json:"type,omitempty"`
	Attributes *MarkAttributes `json:"attrs,omitempty"`
}

type Node

type Node struct {
	Type       NodeType     `json:"type"`
	Version    int          `json:"version,omitempty"`
	Attributes *Attributes  `json:"attrs,omitempty"`
	Content    []*Node      `json:"content,omitempty"`
	Marks      []MarkStruct `json:"marks,omitempty"`
	Text       string       `json:"text,omitempty"`
}

func (*Node) AddContent

func (n *Node) AddContent(c *Node)

type NodeType

type NodeType string

Type represents the type of a node

Jump to

Keyboard shortcuts

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