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

Unwanted space introduced during templating #1084

Open
soypat opened this issue Feb 28, 2025 · 0 comments
Open

Unwanted space introduced during templating #1084

soypat opened this issue Feb 28, 2025 · 0 comments

Comments

@soypat
Copy link

soypat commented Feb 28, 2025

Describe the bug
Unwanted space introduced during templating. Becomes hard to format markdown.

To Reproduce

templ template() {
	{ "\n" }
	@mdTableHeader("Column1", "Column2")
}

templ mdTableHeader(columns ...string) {
	{ "\n" }
	@mdTableRow(columns...)
	for i:= range columns {
		if i == len(columns)-1 {
			{ "|-----|" }
		} else {
			{ "|-----" }
		}
	}
	{ "\n" }
}

templ mdTableRow(columns ...string) {
	{ "|" }
	for _,s := range columns {
		{ s +"|" }
	}
	{ "\n" }
}

Expected behavior
Expected Output:

|Column 1|Column2| 
|-----|-----| 

Actual behaviour
Expected Output:

| Column 1| Column2| 
|----- |-----| 

Screenshots
If applicable, add screenshots or screen captures to help explain your problem.

Logs
If the issue is related to IDE support, run through the LSP troubleshooting section at https://templ.guide/commands-and-tools/ide-support/#troubleshooting-1 and include logs from templ

templ info output

 templ info                                                                        ✔ 
(✓) os [ goos=linux goarch=amd64 ]
(✓) go [ location=/usr/bin/go version=go version go1.23.6 linux/amd64 ]
(✓) gopls [ location=/home/pato/go/bin/gopls version=golang.org/x/tools/gopls v0.18.1 ]
(✓) templ [ location=/home/pato/go/bin/templ version=v0.3.819 ]

Additional context
Add any other context about the problem here.

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