markdown

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Markdown

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

Markdown represents a markdown document that can be built incrementally

func New

func New() *Markdown

New creates a new Markdown instance

func (*Markdown) AddCodeBlock

func (m *Markdown) AddCodeBlock(code string, language string) *Markdown

AddCodeBlock adds a code block with optional language specification

func (*Markdown) AddHeading

func (m *Markdown) AddHeading(text string, level int) *Markdown

AddHeading adds a heading with the specified level (1-6)

func (*Markdown) AddHorizontalRule

func (m *Markdown) AddHorizontalRule() *Markdown

AddHorizontalRule adds a horizontal rule

func (*Markdown) AddList

func (m *Markdown) AddList(items []string) *Markdown

AddList adds a list of items

func (*Markdown) AddParagraph

func (m *Markdown) AddParagraph(text string) *Markdown

AddParagraph adds a paragraph of text

func (*Markdown) AddTable

func (m *Markdown) AddTable(headers []string, data [][]string, skipRepeatColumns ...int) *Markdown

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) Render

func (m *Markdown) Render() (string, error)

Render returns the rendered markdown as a string (without printing)

func (*Markdown) String

func (m *Markdown) String() string

String returns the markdown content as a string

func (*Markdown) WriteTo

func (m *Markdown) WriteTo(w io.Writer) (int64, error)

WriteTo writes the markdown content to the provided io.Writer

func (*Markdown) WriteToTerminal

func (m *Markdown) WriteToTerminal() (int64, error)

WriteToTerminal writes the raw markdown content to stdout without glamour rendering

func (*Markdown) WriteToTerminalWithGlamour

func (m *Markdown) WriteToTerminalWithGlamour() (int64, error)

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)

Jump to

Keyboard shortcuts

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