Hello,
I just find the root cause : when i activate the Page Toc plugin (v3.2.4) with antispam plugin (v1.5.7), i have the issue.
Grav TOC Plugin with new independent Anchor generation to compliment the existing Table-of-Contents support.
Best Regard.
You sure ToC has anything to do with this? I’m almost certain it’s just antispam, because it obfuscates emails in the content.
Basically what happens (ref ):
It will look for plaintext email addresses in your Grav pages and turn them into javascript encoded mailto links.
So I assume in your case, you make an email as a link and then this plugin finds the text and converts it once more to a link (link within a link I suppose).
Try just leaving emails without any linking and antispam should take care of them
P. S. You could file an issue with antispam, that it converts emails to links which already are links. IMHO it should skip those
Sorry karmalakas but yours advices are not to be followed. From the start, you’ve been leading me on false trails. Please don’t reply on this issue.
I put an issue to each plugin
opened 09:43PM - 06 Nov 24 UTC
Antispam plugin v1.5.7 and Page Toc plugin v3.2.4 activated : Issue with the "ma… ilto" anchors
The Antispam code in the HTML send to the browser looks like:
document.write("<a href='mailto:"+link+"' >"+link+"");
However, Antispam injects the following code into the page before it is being send to the browser:
document.write("<a href='mailto:"+link+"' >"+link+"</a>");
---------------------------------------------------------------------------
A bug has been logged on [PHP: Bug #74628 DOM auto remove HTML closing tag in <script> tag when save .](https://bugs.php.net/bug.php?id=74628)
It describes exactly the issue of DOMDocument "eating" closing tags in javascript.
The thread offers two different solutions:
1. Add a backslash (\) at the closing: </a> tag becomes <\/a>
This should be done by the author of AntiSpam in antispam.php line 196
Add an extra flag LIBXML_SCHEMA_CREATE when loading HTML into the DOMDocument
2. This should be done by the author of PageToc in file HtmlHelper.php on line 37
I think it's best if both plugins fix the issue. Please create an issue on both repositories of AntiSpam and PageToc with the suggested solutions. Adding a reference to the bug mentioned above will be helpful.
opened 09:46PM - 06 Nov 24 UTC
Antispam plugin v1.5.7 and Page Toc plugin v3.2.4 activated : Issue with the "ma… ilto" anchors
The Antispam code in the HTML send to the browser looks like:
document.write("<a href='mailto:"+link+"' >"+link+"");
However, Antispam injects the following code into the page before it is being send to the browser:
document.write("<a href='mailto:"+link+"' >"+link+"</a>");
---------------------------------------------------------------------------
A bug has been logged on [PHP: Bug #74628 DOM auto remove HTML closing tag in <script> tag when save .](https://bugs.php.net/bug.php?id=74628)
It describes exactly the issue of DOMDocument "eating" closing tags in javascript.
The thread offers two different solutions:
1. Add a backslash (\) at the closing: </a> tag becomes <\/a>
This should be done by the author of AntiSpam in antispam.php line 196
Add an extra flag LIBXML_SCHEMA_CREATE when loading HTML into the DOMDocument
2. This should be done by the author of PageToc in file HtmlHelper.php on line 37
I think it's best if both plugins fix the issue. Please create an issue on both repositories of AntiSpam and PageToc with the suggested solutions. Adding a reference to the bug mentioned above will be helpful.