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

Allow using HTML or other raw markup as a link URL #217

Open
eliph opened this issue Feb 19, 2022 · 1 comment
Open

Allow using HTML or other raw markup as a link URL #217

eliph opened this issue Feb 19, 2022 · 1 comment

Comments

@eliph
Copy link

eliph commented Feb 19, 2022

Prerequisites

[x ] Are you running the latest version of PHP-Textile?

Problematic Textile markup

Trying to use the Textpattern single tag <txp:file_download_link /> to create a hyperlink fails

Download this: "download link":<txp:file_download_link id="1" />

Expected output

<p>Download this: <a href="https://example.com/index.php?s=file_download&id=1">download link</a></p>

Actual output

<p>Download this: “download link”:https://example.com/index.php?s=file_download&amp;id=1</p>

Additional information

PHP-Textile version: v3.7.6
PHP version: PHP 8.1.3 (PHP-FPM)

@gocom
Copy link
Member

gocom commented May 3, 2022

Unfortunately "download link":<txp:file_download_link id="1" /> is not really valid HTML. This mixes two different templating and syntax languages, which is bound to cause issues. See, Textile has no idea of Textpattern CMS syntax or that it even exists.

If we were to allow <txp:file_download_link id="1" /> to be used as the link URL, it would get sanitized and escaped by PHP-Textile, which in return would mean that the other parser would not pick up that other templating tag.

Textile itself has no understanding of that other language, and as general purpose formatting library and it should not have hard tie-ins to other systems.

The best option in these cases would be to not mix the two languages. Instead, better option would be either use raw HTML, or the other templating languages features.

Could we allow such syntax to be used in Textile? Sure, but it causes it own set of weird, such as Textile allowing and generating outright invalid output document.

Realistically this would require major rewrite of the Textile library with a way of supporting different output document formats. For instance, Textpattern CMS could implement their own output document format that for instance, doesn't sanitize links.

We currently allow raw-blocks, but those are independent of allowing outright invalid syntax to be generated by PHP-Textile; while it also works for Textpatern's templating syntax, it's for developed with universal raw HTML support in mind.

@gocom gocom added this to the 5.0.0 milestone May 3, 2022
@gocom gocom changed the title Make a simple download link Allow using HTML or other raw markup as a link URL May 3, 2022
@gocom gocom modified the milestones: 5.0.0, 6.0.0 Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants