Documentation
¶
Overview ¶
Package markdown turns markdown written by the model into a neutral fragment: headings, paragraphs, list items, code lines and tables with styled inline runs. It refuses, loudly, anything the Docs API cannot express so nothing degrades silently.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Kind BlockKind
Level int // heading level 1-6
Ordered bool
Nesting int // list nesting, 0-based
ListID int // groups consecutive items of one list
Inlines []Inline
Lines []string // code block lines
Table *Table
Line int // 1-based source line, for errors
}
Block is one paragraph-level element.
type Fragment ¶
type Fragment struct {
Blocks []*Block
}
Fragment is parsed markdown.
func Parse ¶
Parse converts markdown to a fragment. Plain text is valid markdown, so any string parses; only constructs without a Docs equivalent fail.
func (*Fragment) SingleParagraph ¶
SingleParagraph reports whether the fragment is one plain paragraph with no formatting, and returns its text. Such fragments can be applied as a minimal diff.
type Table ¶
type Table struct {
Rows [][][]Inline
}
Table is a GFM table; the first row is the header.
type UnsupportedError ¶
UnsupportedError names a construct the Docs API cannot take.
func (*UnsupportedError) Error ¶
func (e *UnsupportedError) Error() string