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

Indentation issue when using copy button #345

Open
savioribeiro opened this issue Oct 29, 2024 · 4 comments
Open

Indentation issue when using copy button #345

savioribeiro opened this issue Oct 29, 2024 · 4 comments

Comments

@savioribeiro
Copy link

Hello!

When I insert a block of code into a post, the indentation is displayed normally. However, when I use the copy button, the indentation is lost.

Apparently this is caused by the cache plugin that I use to minify all the code on the page, W3 Total Cache.

Because the copied code is the same as the one that appears in the page's source code.

Is there any way to solve this issue without having to disable the W3 Total Cache minify feature?

@KevinBatdorf
Copy link
Owner

Thanks for reporting. Do they have any setting to allow html attributes? Seems like a bug in their code to be stripping out valid whitespace like this. You could also not minify html at all for now.

I'll try to dig in and see if there's something I can do to exclude it, or another workaround.

@savioribeiro
Copy link
Author

Thank you for the quick response.

Here on this page about HTML minification on the official W3 Total Cache website, there is a setting about ignoring comments. But if I understand correctly, it only applies to not removing comments from the source code, not preserving spaces from an element between two comments, for example.

@KevinBatdorf
Copy link
Owner

If you disable the html minify it works? What if you select/deselect the "Line break removal" option? Any difference?

@savioribeiro
Copy link
Author

savioribeiro commented Nov 9, 2024

Sorry for the late reply.

I disabled HTML minification and the copy button works perfectly - the indentation is not lost in this case.

The 'Line break removal' was already disabled.

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

2 participants