Documentation
¶
Index ¶
- type AlertKind
- type Markdown
- func (m *Markdown) AddAlert(kind AlertKind, body string) *Markdown
- func (m *Markdown) AddCodeBlock(code string, language string) *Markdown
- func (m *Markdown) AddHeading(text string, level int) *Markdown
- func (m *Markdown) AddHorizontalRule() *Markdown
- func (m *Markdown) AddList(items []string) *Markdown
- func (m *Markdown) AddOrderedList(items []string) *Markdown
- func (m *Markdown) AddParagraph(text string) *Markdown
- func (m *Markdown) AddTable(headers []string, data [][]string, skipRepeatColumns ...int) *Markdown
- func (m *Markdown) Print(opts ...PrintOptions) error
- func (m *Markdown) Render() (string, error)
- func (m *Markdown) String() string
- func (m *Markdown) WriteTo(w io.Writer) (int64, error)
- func (m *Markdown) WriteToTerminal() (int64, error)
- func (m *Markdown) WriteToTerminalWithGlamour() (int64, error)
- type PrintOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertKind ¶ added in v0.11.0
type AlertKind string
AlertKind is a GitHub-flavored-markdown alert type. Renderers that support alerts (GitHub and most others) color and badge them; the rest fall back to a plain blockquote, so the callout stays readable everywhere and needs no emoji.
const ( AlertNote AlertKind = "NOTE" // informational AlertTip AlertKind = "TIP" // helpful suggestion AlertImportant AlertKind = "IMPORTANT" // action the reader must take AlertWarning AlertKind = "WARNING" // needs attention / caution AlertCaution AlertKind = "CAUTION" // risk of a negative outcome )
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown represents a markdown document that can be built incrementally
func (*Markdown) AddAlert ¶ added in v0.11.0
AddAlert adds a GitHub-style alert blockquote (`> [!KIND]`) with the given body. A multi-line body keeps every line inside the blockquote, so lists (`- item`) and paragraphs render within the callout.
func (*Markdown) AddCodeBlock ¶
AddCodeBlock adds a code block with optional language specification
func (*Markdown) AddHeading ¶
AddHeading adds a heading with the specified level (1-6)
func (*Markdown) AddHorizontalRule ¶
AddHorizontalRule adds a horizontal rule
func (*Markdown) AddOrderedList ¶ added in v0.11.0
AddOrderedList adds a numbered list of items (`1. item`), for steps whose order matters.
func (*Markdown) AddParagraph ¶
AddParagraph adds a paragraph of text
func (*Markdown) AddTable ¶
AddTable adds a table with the given headers and data skipRepeatColumns is an optional slice of column indices (0-based) that should not repeat values
func (*Markdown) Print ¶
func (m *Markdown) Print(opts ...PrintOptions) error
Print renders the markdown and outputs it according to the provided options
func (*Markdown) WriteToTerminal ¶
WriteToTerminal writes the raw markdown content to stdout without glamour rendering
func (*Markdown) WriteToTerminalWithGlamour ¶
WriteToTerminalWithGlamour writes the rendered markdown content to stdout using glamour
type PrintOptions ¶
type PrintOptions struct {
ToTerminal bool // Print to terminal with glamour rendering
ToFile string // File path to save raw markdown (empty string = don't save to file)
}
PrintOptions configures where and how to print the markdown
func DefaultPrintOptions ¶
func DefaultPrintOptions() PrintOptions
DefaultPrintOptions returns default options (terminal only)