Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consistently handle inline elements with spaces
This resolves some odd situations that can occur when there are inline elements that contain spaces in sentences. The first situation is when there is an element that includes a space between words, for example 'Test<span> </span>content'. This would previously have produced a two space result: 'Test content' because this element would have matched both leading and trailing whitespace tests. The second situation is when there is an element that includes a space outside the tests, which is the case of a non-breaking space character (unicode U+00A0), then the space is removed. An example of this is 'Test<span> </span>content' which would result in 'Testcontent' as this wouldn't match the tests for leading/trailing whitespace. This resolves these problems by changing the whitespace tests to use \s rather than a subset of space characters (which is consistent with the blank test [1]) and only allows a leading space if the test for both leading and trailing whitespace passes on a blank element. [1]: https://github.com/domchristie/turndown/blob/80297cebeae4b35c8d299b1741b383c74eddc7c1/src/node.js#L14
- Loading branch information