-
Notifications
You must be signed in to change notification settings - Fork 21
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
trimWhiteSpace only trims newlines at the start of content #19
Comments
I actually implemented it this way on purpose. This way a conflict with the <p>
Lorem ipsum
dolor sit amet
</p> The raw content of the element is:
With
With
Now I agree that the documentation doesn't fully describe how the option works. I would appreciate if you could share your use case with me so I can determine whether it makes sense to release a new version or if it is enough to update the documentation. Thanks! |
I see what you mean. I think it would be nice if it used the current regex or the one I'm recommending above contextually based on whether Maybe instead just a documentation update to clarify how As for my use case -- I was just trying to generate "clean" message IDs. Once I discovered this quirk, I was able to work around it. The challenge is that I'm consuming my language files inside a web browser and I need my JS to extract message IDs from markup the same way |
Thanks for your answer. If your goal is to generate "clean" message IDs why not just use the same regex for removing indentation during runtime? I'm still contemplating what to do here and having message ids like this doesn't seem very desirable to me:
|
Because I expected |
Sorry for my late response. I've now added a comment to the documentation that hopefully makes it clear enough that, in combination with |
The documentation for the
trimWhiteSpace
option of HtmlExtractor indicates:The actual implementation, below, only trims newline characters from the start of string, but all whitespace characters from the end.
I believe that should be
content.replace(/^\s+|\s+$/g, '')
.The text was updated successfully, but these errors were encountered: