I am trying to setup a Telegram Instant View for a website.
i have a text with a lot of break-lines \n
and no <br>
so
i need a solution to replace every \n
to <br>
I am trying to setup a Telegram Instant View for a website.
i have a text with a lot of break-lines \n
and no <br>
so
i need a solution to replace every \n
to <br>
There is no way (in the Instant View DSL) to replace a part of a text node with an HTML tag (i.e. element node). Any HTML you insert as text will be escaped.
As I remember, if you debug $paragraph/text()
, there will be a lot of text nodes, that are separated with \n
in the original markup:
[0]: first line
[1]: second line
So, the only thing you need to do is just @after(<br>): $paragraph/text()
.
It's better not to make a big long paragraph with <br>
inside — split text on small <p>
aragraphs.