Skip to content
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

About text node #18

Open
Jocs opened this issue Oct 20, 2018 · 0 comments
Open

About text node #18

Jocs opened this issue Oct 20, 2018 · 0 comments

Comments

@Jocs
Copy link

Jocs commented Oct 20, 2018

Thank you very much for providing such a good tool. I have encountered some problems during use. The problem may appear in this code:

    // if a node is nothing but whitespace, collapse it as the spec states:
    // https://www.w3.org/TR/html4/struct/text.html#h-9.1
    if (/^\s*$/.test(content)) {
        content = ' ';
    }

Then I research the Spec and found this:

Note that a sequence of white spaces between words in the source document may result in an entirely different rendered inter-word spacing (except in the case of the PRE element). In particular, user agents should collapse input white space sequences when producing output inter-word space. This can and should be done even in the absence of language information (from the lang attribute, the HTTP "Content-Language" header field (see [RFC2616], section 14.12), user agent settings, etc.).
The PRE element is used for preformatted text, where white space is significant.

Coincidentally, I am about to show multiple spaces in the pre element, but when using html-parse-stringify2, it merges all the spaces into one. So if it possible to provide a configuration item for the user to choose whether or not to merge spaces?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant