-
Notifications
You must be signed in to change notification settings - Fork 25
[WIP] Fix missing line break with anchors #80
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
Conversation
66936df
to
7554075
Compare
Thanks for taking care of this one. About spaces ... I don't know if it's possible, but my opinion would be to never deal with spaces manually unless it's required (e.g. inside a |
@javiereguiluz do you mean that you would prefer that the templates never use the Thanks! |
7554075
to
b3e4598
Compare
Yes, I meant that ... but maybe now that we already use |
b3e4598
to
107fe8b
Compare
Ok, for now, let's handle this in our repo, removing spaceless on a case-by-case basis :) |
Spaceless is about removing spaces between sibling HTML tags. but when these tags are inline elements, the whitespaces are relevant to the rendering. In my experience, lots of cases using spaceless are using it to remove the template indentation, which is a misuse for 2 reasons:
The proper solution to remove spaces introduced by template indentation is to use the Twig whitespace control feature instead (which also has the nice performance benefit of being a compile-time feature rather than a runtime one) |
This fixes #37
But... the fix should maybe go upstream to docrtrine... and I don't quite understand it. I included some test normalization in this PR, but the ACTUAL bug fix was to copy the
paragraph.html.twig
template fromrst-parser
into our project and customize it. Here are the changes:Yes, the
spaceless
was having bad side effects. What would happen is that thetext
variable would be set to something like this (with line breaks):The line break caused the word
details
andCRUD
to have a space between them. But thespaceless
killed that.Are we somehow misusing / abusing spaceless? Should we remove all the spaceless upstream in the Doctrine templates?
Silly spacing thing in test depends on doctrine/rst-parser#141
Cheers!