Skip to content

caddy fmt does not format multi-line strings properlyΒ #7425

@ChlorideCull

Description

@ChlorideCull

Issue Details

Messing around with trying templating, and found that the caddy fmt command doesn't handle multi-line strings properly, as in that it will change their content.

For example, with this Caddyfile:

{
	local_certs
	key_type rsa2048
}

https://localhost:8953 {
	log
	templates
	header Content-Type text/plain
	respond `Here are some random numbers:

{{randNumeric 16}}

Hope this helps.`
}

running fmt will output this:

{
        local_certs
        key_type rsa2048
}

https://localhost:8953 {
        log
        templates
        header Content-Type text/plain
        respond `Here are some random numbers: {{

        randNumeric 16}}

        Hope this helps.`
}

Needless to say, these will not have the same output.

I'm using the win64 build of 2.10.2 found under the GitHub releases.

Assistance Disclosure

AI not used

If AI was used, describe the extent to which it was used.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions