formatters

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 11 Imported by: 0 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 formatters groups the formatting tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONInputError added in v0.2.0

func JSONInputError(in string, err error) error

JSONInputError turns an encoding/json error on in into an InputError with the line and column of the culprit. Other JSON tools reuse it.

Types

type JSONFormat

type JSONFormat struct{}

JSONFormat indents, minifies and sorts JSON.

func (JSONFormat) Detect

func (JSONFormat) Detect(sample string) float64

Detect recognises a valid JSON object or array.

func (JSONFormat) Run

func (j JSONFormat) Run(ctx context.Context, req tool.Request) (tool.Result, error)

func (JSONFormat) Spec

func (JSONFormat) Spec() tool.Spec

type XMLFormat

type XMLFormat struct{}

XMLFormat re-indents XML keeping each token's original text (attributes, comments, CDATA, processing instructions and DOCTYPE).

func (XMLFormat) Detect

func (XMLFormat) Detect(sample string) float64

Detect recognises XML that tokenises without errors in its first 50 tokens and has at least one element.

func (XMLFormat) Run

func (x XMLFormat) Run(ctx context.Context, req tool.Request) (tool.Result, error)

func (XMLFormat) Spec

func (XMLFormat) Spec() tool.Spec

Jump to

Keyboard shortcuts

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