-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Templates for inline code don't remove leading and trailing whitespace #7309
Comments
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
Still an issue to consider, I suppose. |
Maybe, but you need to take this upstream in the Go project. |
Ah, I see. Then we should indeed not attempt to solve it as a part of Hugo. Is there a way to label it as an upstream issue, just for the sake of documentation and clarity? |
But also note that I have seen many "template whitespace discussions" on that issue tracker, and I would not be too optimistic. T |
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
I'd keep this one open, but I don't insist. |
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using?
0.71.0, the currently latest release.
This is a followup to #6832, which didn't receive a solution.
Regarding newlines at EOF
Having a newline at end of file isn't exactly strange, but Unix standard. On Unix, text without a newline isn't a line, a text file without a newline inside is considered empty by many tools.
wc
don't count text without newline.That's why code editors usually add newlines at EOF automatically.
Regarding whitespace at BOF
Similar for leading whitespace: many code projects add copyright headers and similar stuff early in every file (e.g. Hugo). Hugo nicely supports this and removes comments for rendering, but this usually leaves some leading whitespace behind.
In short ...
Hugo should really remove whitespace at start and end of templates used inline. Just as if the whole file was wrapped in
{{-
and-}}
.The text was updated successfully, but these errors were encountered: