Skip to content
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

Strips down <i> tag #1

Open
Ahuahuachi opened this issue Jan 27, 2016 · 8 comments
Open

Strips down <i> tag #1

Ahuahuachi opened this issue Jan 27, 2016 · 8 comments

Comments

@Ahuahuachi
Copy link

Don't know if this is an issue, but if you activate the "strip down comments" option, it also strips down the < i > tag, which I use it for the Font Awesome icons.

@jnaskali
Copy link
Contributor

This is especially an issue with fontawesome, which uses empty < i > tags for icon placement.

I thought adding the tag to empty_tags and inline_tags would do the trick, but this has no effect. As a workaround, I add a html comment inside the tags. It gets removed, but tidy still lets the tag itself stay: <i class="fa fa-github" aria-hidden="true"><!--icon--></i>

@sourcesoldier
Copy link
Owner

@Ahuahuachi Thanks for the report. I did some research and it seems like this is know problem in the outdated versions of tidy. Apparently the most OS dists like Debian, etc. are using totally outdated versions.

I guess updating (meaning self-compiling to a more recent fork) could help in this case. Then there should be an option {"drop-empty-elements":"no"} that tackles the problem.

I believe the only way of making this work for a broad majority would be a dirty workaround with implementing a new fake TAG, introducing this in the new-empty-elementsoption and then replacing it in the cleaned output again. Kinda hackish but might work ...

@OleVik
Copy link

OleVik commented May 20, 2016

Can confirm that this is an issue, spent some hours debugging and the lack of an option to not drop empty elements can cause major issues in functionality that is common to modern HTML5-patterns. Lot of frameworks depend on <i>-elements for navigation - both visual and with ARIA - and the current version of the plugin breaks this.

@sourcesoldier
Copy link
Owner

@OleVik that's true, sadly.

I've managed to compile my own version of php-tidy on my Debian Wheezy. That's a lot more stable and actually respects the settings, that my module is setting (e.g. new-empy-elements). Unfortunately the version that get's shipped with most package maintainers (e.g. apt-get, aptitute) is almost 3 years old and buggy.

I guess a solution could be to bound this module to a specific mayor version of php-tidy and only enabled it with prior warning.

@jonsparks
Copy link

Has there been any progress made on this? I'm having the same problem on one of my sites.

@gidlov
Copy link
Contributor

gidlov commented Dec 5, 2017

@jonsparks
I do not know if this is the solution, but it works for me (PHP 7.1.12-1 &
libTidy 5.4.0). I have added an option to drop empty elements that fix this in my fork. According to Tidy documentation, this option is available since version 5.0.0. By default, this is done.

@sourcesoldier
Copy link
Owner

@jonsparks I've merged the changes by @gidlov, can you check if that solves your issue?

@Dadido3
Copy link

Dadido3 commented Apr 2, 2019

I had the same problem here, and the new option fixes the problem.

But it would be nice if it could be released, as the grav plugin manager is still downloading the version from 2016.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants