tabindent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tabindent configures structural YAML indentation.

ModeAuto defaults to automatic loading and tab dumping. ModeTabs defaults to tab loading and tab dumping. Explicit load and dump options override those presets.

Index

Constants

View Source
const (
	ModeAuto = yaml.IndentModeAuto
	ModeTabs = yaml.IndentModeTabs
)
View Source
const (
	StyleAuto   = yaml.IndentStyleAuto
	StyleSpaces = yaml.IndentStyleSpaces
	StyleTabs   = yaml.IndentStyleTabs
)
View Source
const (
	ScopeDocument = yaml.IndentScopeDocument
	ScopeStream   = yaml.IndentScopeStream
)

Variables

This section is empty.

Functions

func Register

func Register() error

Register enables tab-indent in yaml.OptsYAML and yaml.WithNamedPlugin.

Types

type Mode

type Mode = yaml.IndentMode

Mode supplies loading and dumping defaults.

type Option

type Option func(*Plugin)

Option configures a Plugin.

func WithAuto

func WithAuto(scope Scope) Option

WithAuto sets the auto-detection scope.

func WithDump

func WithDump(style Style) Option

WithDump sets emitted structural indentation.

func WithLoad

func WithLoad(style Style) Option

WithLoad sets accepted structural indentation.

func WithMode

func WithMode(mode Mode) Option

WithMode sets the indentation mode.

type Plugin

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

Plugin configures tab-aware YAML loading and dumping.

func New

func New(opts ...Option) *Plugin

New creates a tab-indentation plugin.

func NewFromYAML

func NewFromYAML(cfg map[string]any) (*Plugin, error)

NewFromYAML creates a plugin from a named-plugin configuration.

func (*Plugin) TabIndentConfig

func (p *Plugin) TabIndentConfig() yaml.IndentConfig

TabIndentConfig implements yaml.TabIndentPlugin.

type Scope

type Scope = yaml.IndentScope

Scope controls how long an auto-detected style remains active.

type Style

type Style = yaml.IndentStyle

Style identifies the characters used for structural indentation.

Jump to

Keyboard shortcuts

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