Skip to content

XML pretty-printing introduces weird whitespace. #864

Open
@pinkisemils

Description

@pinkisemils

I'm running version HTML Tidy for Linux version 5.6.0 and I've got some weird white-space pretty printing issue.
Given a small XML file like this -

<Small>
    <LongLongElement some:attr="aaaaaa"
            other:attr="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
            >
        <InnerElement/>
    </LongLongElement>
</Small>

and invoking tidy as follows

tidy -xml \
    -i  \
    --quiet yes \
    --indent-attributes yes \
    --indent-spaces 4 \
    --literal-attributes yes

the output produced has some weird trailing white space.

<Small>
    <LongLongElement some:attr="aaaaaa"
                     other:attr="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb">
                      <- This is actually whitespace
        <InnerElement />
    </LongLongElement>
</Small>

Is this the expected behavior? If so, is there any flag I can use to not have that whitespace be added?
I presume the element name length matters but attribute value length doesn't because of --literal-attributes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions