cms_pico icon indicating copy to clipboard operation
cms_pico copied to clipboard

Target Blank

Open KvL159 opened this issue 4 years ago • 8 comments

First of all, thank you for this great add-on to Nextcloud !

I'm trying to set some links with target blank to open them in new tabs/new windows.

I found some answer about how to handle it in Markdown, but it doesn't seem to work with CMS Pico in Nextcloud: https://stackoverflow.com/questions/4425198/can-i-create-links-with-target-blank-in-markdown

I did try [text](url){:target="_blank"} as suggested in the link above, however it ignores what's after the url and shows it as text.

KvL159 avatar Jan 21 '21 06:01 KvL159

Unfortunately that's not possible right now, because Parsedown, the Markdown parser Pico uses, isn't capable of doing so.

PhrozenByte avatar Jan 21 '21 09:01 PhrozenByte

Thank you @PhrozenByte

I found that "parsedown-extra-plugin" may offer such function, do you think it can be added to Pico ?

https://github.com/taufik-nurrohman/parsedown-extra-plugin#automatic-relnofollow-attribute-on-external-links

Upstream discussion: https://github.com/erusev/parsedown/issues/494

KvL159 avatar Jan 22 '21 05:01 KvL159

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1:

github-actions[bot] avatar Mar 09 '21 12:03 github-actions[bot]

Sorry for reviving an old thread! I have just come across it and was wondering why this cannot be circumvented by specifying the link as HTML in the Markdown like <a href="https://github.com/nextcloud/cms_pico" target="_blank">cms_pico</a>.

The link is shown but does not behave as hoped. Is this expected behavior? If so, is there any reason not to adapt it?

sm8ps avatar Sep 27 '22 13:09 sm8ps

@sm8ps HTMLPurifier doesn't allow this by default. However, target="_blank" yields no threats in our scenario, so we should add it to the allow list. Thus I'm transforming this issue to an suggestion.

PhrozenByte avatar Sep 27 '22 13:09 PhrozenByte

Great, thanks! I think this will be much appreciated by many users.

sm8ps avatar Sep 27 '22 14:09 sm8ps

Any news on this? Where can this be added to the whitelist?

Thanks a lot!

new-on-github avatar Jul 01 '23 10:07 new-on-github