Skip to content

Whitespace is incorrectly preserved when xmlWhitespaceSensitivity is set to ignore #789

Open
@Comandeer

Description

@Comandeer

According to the XML specification, only \t, \n, \r, and (space character) are considered whitespace and are affected by the xml:space attribute. As it has been already raised in #768, the plugin used String#trim() to remove whitespace characters, affecting also other non-XML whitespace characters:

This issue has been fixed in 6170e95. However, the fix still affects most of the characters mentioned above due to the usage of the \s character class and the issue described originally in #768 still persists.

Probably the easiest way to fix the issue is to replace the \s character class with the (space character):

const content = chardata.TEXT.replaceAll(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions