ezyang / ezyang/htmlpurifier

linkify

Open
#294 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

php 8.0, master / 4.13 / 4.12

having issues making it work properly
assuming this config, can also be only linkify

        $config->set('HTML.Allowed', 'b,strong,i,p,a[href|rel|target]');
        $config->set('HTML.Doctype', 'HTML 4.01 Transitional');
        $config->set('AutoFormat.Linkify', true);
        $config->set('URI.AllowedSchemes', [
            'https'
        ]);
        $config->set('HTML.Nofollow', true);
        $config->set('HTML.TargetNoopener', true);
        $config->set('HTML.TargetNoreferrer', true);
        $config->set('HTML.TargetBlank', true);
        $config->set('AutoFormat.AutoParagraph', true);
        $config->set('AutoFormat.RemoveEmpty', true);
        $config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);

results will be
http://google.com -> <p><a>http://google.com</a></p> unnecesary a tags

https://google.com -> <p><a href="https://google.com" rel="nofollow noreferrer noopener" target="_blank">https://google.com</a></p> good

sometexthttps://google.com -> <p><a>sometexthttps://google.com</a></p> mising href and doesnt separate text from link

receive same resutls in demo page http://htmlpurifier.org/demo.php?filter%5BAutoFormat.AutoParagraph%5D=1&filter%5BAutoFormat.DisplayLinkURI%5D=1&filter%5BAutoFormat.Linkify%5D=1&filter%5BAutoFormat.RemoveEmpty%5D=1&filter%5BAutoFormat.RemoveSpansWithoutAttributes%5D=1&filter%5BNull_CSS.AllowedProperties%5D=1&filter%5BCore.CollectErrors%5D=1&filter%5BHTML.Allowed%5D=b%2Cstrong%2Ci%2Cp%2Ca%5Bhref%7Crel%7Ctarget%5D&filter%5BHTML.Doctype%5D=HTML+4.01+Transitional&filter%5BHTML.SafeObject%5D=0&filter%5BHTML.TidyLevel%5D=medium&filter%5BURI.DisableExternalResources%5D=0&filter%5BNull_URI.Munge%5D=1&html=%3Cp%3Eaaahttp%3A%2F%2Fhtmlpurifier.org%2Fdemo.php%3C%2Fp%3E%0D%0A%3Cp%3Ehttp%3A%2F%2Fgoogle.com%3C%2Fp%3E&submit=Submit
interestingly checking "experimental" checkbox fixes everything

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported outputs with the PHP 8.0 configuration in the issue, then compare the normal and experimental demo behavior. Trace the AutoFormat.Linkify handling for plain and embedded URLs; done means valid URLs receive the expected href and surrounding text is separated without unnecessary empty anchors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.