-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix missing line break at end tag #1819
Fix missing line break at end tag #1819
Conversation
First commit (#1718)Detailsthere's an explicit check against this in Current code:
Originally introduced in 0e9ad61 (#1407) It's an important check though, newlines shouldn't be printed before inline elements. FixCurrently This pr just sets |
1988818
to
9d0d14b
Compare
Expanded the scope of this pr to include (#1365) since the symptoms are similar; Second commit (#1365)As mentioned here #1365 (comment), this commit adds newline detection for starting inline tags. If the parent is a non-inline element, we set I'm not sure of the expected behaviour for ending inline tag tokens with newlines though (left as is):
currently beautifies into:
if we add a similar check,
which should be the correct behaviour? the below force push is just me forgetting to run |
9d0d14b
to
947566f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. I'm going to do a few manual tests before merging.
To answer your question, while the second output feels correct, I think the first output is actually correct. The new line occurs inside the
However, I did find a different case that is not correct. Input
Current output is same as above. Expected output:
Don't worry about fixing this issue, I'll make some tweaks to what you did and merge. Thanks! |
agreed, that makes sense.
neat, thanks for looking at this as well! |
This is turned into a significantly more complex change. Adding tests for edge cases exposed more issues (most of the preexisting) that needed fixing. The result is an implementation with fewer code paths, but more churn in this PR. |
Description
master
)Fixes Issue: #1718, #1365
Before Merge Checklist
These items can be completed after PR is created.
(Check any items that are not applicable (NA) for this PR)