danpros / htmly

Simple and fast databaseless PHP blogging platform, and Flat-File CMS
https://www.htmly.com
GNU General Public License v2.0
1.01k stars 258 forks source link

Automatically convert URLs into clickable links in posts and pages #758

Closed KuJoe closed 1 month ago

KuJoe commented 1 month ago

Properly formatted URLs are detected and converted to clickable links in posts and pages. Ignores URLs already clickable and removes </p> added to some links at the end of lines.

Tested as best I could but I'm sure there will be some cases where this will not work or cause some issues but for properly formatted links this works as expected.

Should resolve #422

danpros commented 1 month ago

This feature should optional because it far more easier to create auto link compared to remove the auto link.

To create auto link we can use theme functions.php and create a custom function there. Example we use it in post.html.php

<?php echo auto_clickable($p->body);?>
danpros commented 1 month ago

The theme functions.php available since version 2.9.1 so it is not yet widely used.

KuJoe commented 1 month ago

Thank you for explaining this! I wasn't aware of the functions.php feature in themes but after doing some more research I was able to figure it out very easily.

I don't like the idea of having to change the code for the existing themes, but it works good. This PR will be closed.