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

truncate html text and keep tag safe #25

Open
AbraaoAlves opened this issue Feb 25, 2016 · 1 comment
Open

truncate html text and keep tag safe #25

AbraaoAlves opened this issue Feb 25, 2016 · 1 comment
Labels

Comments

@AbraaoAlves
Copy link

Sample:

characterFilter('

hello world

', 4)
//

hell...

@BernardoSilva
Copy link
Owner

Can you provide a more specific use case for this?

Maybe you want to use this on a field that was saved using a rich text editor?

In this case you might end up with empty tags with no content. is that what you expect?

if you have:

characterFilter('<p>Hello<b>World</b></p>', 5);

You would end up with:

<p>Hello<b></b></p>...

This will also cause problems to where the ellipsis would be added.
In this case it would break the formatting because it's outside the

.

Not sure if this adds any value.

Probably the best way for your case could be restrict the characters in your input...

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

No branches or pull requests

2 participants