formatter

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatString

func FormatString(content string) (string, error)

FormatString is a convenience function that formats a template string.

func IndentString

func IndentString(text string, level int, width int) string

IndentString indents each line of text by the given level.

Types

type Formatter

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

Formatter handles formatting of vuego templates.

func NewFormatter

func NewFormatter() *Formatter

NewFormatter creates a new formatter with default options.

func NewFormatterWithOptions

func NewFormatterWithOptions(opts FormatterOptions) *Formatter

NewFormatterWithOptions creates a new formatter with custom options.

func (*Formatter) Format

func (f *Formatter) Format(content string) (string, error)

Format formats a vuego template string and returns the formatted result. It handles both full documents and partial fragments.

type FormatterOptions

type FormatterOptions struct {
	IndentWidth int  // Number of spaces per indent level (default: 2)
	InsertFinal bool // Insert final newline (default: true)
}

FormatterOptions provides configuration for formatting.

func DefaultFormatterOptions

func DefaultFormatterOptions() FormatterOptions

DefaultFormatterOptions returns the default formatting options.

Jump to

Keyboard shortcuts

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