Skip to content

feat: trim whitespace #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andreyvolokitin
Copy link
Contributor

Remove whitespace at the start/end of the first/last text node. Related: posthtml/posthtml-include#19.

I realized that for posthtml-extend it makes sense to remove not only line breaks but all whitespace instead. Because it can interfere with formatting, when actual html is inside multiple nested control tags, i.e. <block> inside <extends>:

<extends src="foo.html">
    <block name="bar">
        << Parasitic whitespace to the left (as well as a line break above and below)
    </block>
</extends>

If there is whitespace in the middle of a string, then it remains untouched and definitely should be handled by html beautifier later:

<extends src="foo.html">
    <block name="bar">
        << Parasitic whitespace to the left (as well as a line break  above and below).
        << Parasitic whitespace to the left again, this time it gets inserted to the actual output
    </block>
</extends>

Remove whitespace at the start/end of the first/last text node. Details: posthtml/posthtml-include#19
@Scrum Scrum added the feat label Sep 10, 2018
@Scrum Scrum added this to the 0.12.0 milestone Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants