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

Add Support for {{}} syntax #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

yuichkun
Copy link

@yuichkun yuichkun commented Mar 24, 2021

Summary

Hi, there!

When I posted this issue, I was misunderstanding this library's intention to use v-html rather than the {{}} syntax that vue provides.

I thought it would be nicer if there's an option to use {{}}, as it is safer in terms of XSS attack, which is what Vue.js itself suggests in the docs.

So, this PR intends to add support for such case, while preserving the original behavior of supporting v-html.

Notice:

vue-linkify kind of worked with {{}} syntax even without this PR, but it did have a re-render issue above, so this PR tries to solve that as well :)

Example

With this PR,

<div v-linkified>
      <h2>With new vue-linkify</h2>
       my site: {{ msg }}
</div>

will be converted to

<!-- suppose you provide msg as "https://google.com" -->
<div>
      <h2>With new vue-linkify</h2>
       my site: <a href="https://google.com" class="linkified" target="_blank">https://google.com</a>
</div>

@phanan
Copy link
Owner

phanan commented Mar 24, 2021

I'm not too convinced by this additional feature TBH. String interop with {{}} is meant to escape special HTML characters and should be used as such. Also, linkifying in itself means the user should be aware of the implications (XSS attacks).

In short, I don't think the additional code (and with it, maintenance) is worth the extra functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants