-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Bug Report: bracketSameLine option splits closing tags across lines
Description
When using bracketSameLine: true, the plugin incorrectly splits closing HTML tags across multiple lines (e.g., </a> becomes </a on one line and > on the next), which breaks Hugo template parsing.
Configuration
.prettierrc:
{
"plugins": ["prettier-plugin-go-template"],
"overrides": [
{
"files": "*.html",
"options": {
"parser": "go-template",
"bracketSameLine": true
}
}
]
}Input
{{- $url := "https://example.com" -}}
<a href="{{ $url }}" class="link" target="_blank">Link Text</a>Current Output (buggy)
{{- $url := "https://example.com" -}}
<a
href="{{ $url }}"
class="link"
target="_blank"
>Link Text</a
>Note: The closing </a> tag is split into </a and > on separate lines.
Expected Output
{{- $url := "https://example.com" -}}
<a href="{{ $url }}" class="link" target="_blank">Link Text</a>With bracketSameLine: true, the entire tag should remain on one line, or at minimum, the closing tag should not be split.
Impact
Hugo's template parser generates malformed HTML when the closing tag is split:
<a< p="">This makes the link invisible/non-functional.
Environment
prettier-plugin-go-template: 0.0.15prettier: 3.8.0- Hugo shortcode context (
.htmlfiles inlayouts/shortcodes/)
Workaround
Currently using .prettierignore to exclude shortcode files from formatting.
Note on Project Status
I'm aware from #123 that this project may be archived. Filing this issue to document the bug for anyone who forks/maintains the project in the future.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels