Jim Myhrberg b2057429a1 fix(whitespace): remove leading line-break from input
This effectively cleans up what I consider syntactical sugar required
due to Go's syntax. For example:

    str := undent.String(`
        hello
        world`,
    )

In the above example I would consider the initial line-break after the
opening back-tick (`) character syntactical sugar, and hence should be
discarded from the final undented string.

However if the literal string contains more than one initial line-break,
only the first one should be removed, as the rest would intentionally be
part of the input.
2020-12-07 10:43:26 +00:00
2020-11-26 04:31:56 +00:00

undent

Go package which removes leading indentation/white-space from strings and byte slices.

Go Reference GitHub tag (latest SemVer) Actions Status Coverage GitHub issues GitHub pull requests License Status

s := undent.String(`
	{
	  "hello": "world"
	}`,
)
fmt.Println(s)
{
  "hello": "world"
}

Documentation

Please see the Go Reference for documentation and examples.

Benchmarks

Benchmark reports and graphs are available here: https://jimeh.me/undent/dev/bench/

License

MIT

Description
Go package which removes leading indentation/white-space from strings.
Readme MIT 299 KiB
Languages
Go 89.6%
Makefile 10.4%