Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dedent incorrectly removes spaces that aren't at the start of a line #72

Open
dadgar opened this issue Jan 27, 2024 · 0 comments
Open

Comments

@dadgar
Copy link

dadgar commented Jan 27, 2024

When a string has lines with no indentation and lines with indentations, the dedented string will remove the first spaces within the line instead of just at the start.

package main

import (
	"fmt"

	"github.com/muesli/reflow/dedent"
)

func main() {
	input := `This is an example
	
  with no shared indent.`
	fmt.Println(dedent.String(input))
}

The output will be:

Thisisan example

with no shared indent.

https://go.dev/play/p/Q13CeRD8Tb2

@dadgar dadgar changed the title Dedent removes first space Dedent incorrectly removes spaces that aren't at the start of a line Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant