Closed alexandre1985 closed 8 years ago
You can use filters, its in the documentation.
var Xray = require('x-ray');
var x = Xray({
filters: {
clean: function (value){
value.replace('<br />', '');
return value;
}
}
});
Then you can call it as below:
x('http://mat.io', {
content: 'content | clean'
})
@tokhi you didn't understand it right. I don't want to remove the
I want it to be shown! With xray like it is, it doesn't show the
's...
I'm making some progress. With x(string, '#'+duracao, ['p@html'])
I'm able to show the
but the problem now is that the text isn't showing like utf-8.
For example: ã
is showing like ã
.
Any fixes for this problem?
Add this to your filter then you should be good:
return JSON.parse( JSON.stringify( value ) ); // This should be able to render the ã
Thank you @tokhi . It didn't work. I was able to decode the numeric entities by adding the module 'entities'. I didn't want a new dependency but now it's working
gr8, plz add your solution to help others and close the ticket if you are satisfied.
tags disappear from output
I'm getting some
from a webpage with this command
x(page, '#myid', ['p'])...
. Sometimes the text that I want to show is separated byand everything is fine. But sometimes the text is separated by
(or can even be
only) and I would want to split those
. The problem is that with my command it doesn't show any
on the output (and those exist); so I can't split that string. Is there anyway to show the
on the output ?
Your environment
Steps to reproduce
Expected behaviour
text
text
text
text
Actual behaviour
texttexttexttext