Telegram's instant view API: Element <img> is not supported in <p>

℡╲_俬逩灬. 提交于 2020-05-29 10:14:05

问题


I have problem when trying to create my Telegram's Instant View template, with this error:

Element <img> is not supported in <p>: <img src="mysrc" />

So, I decided to replace tag <p> if has <img> tag with <figure> tag

@replace_tag(<figure>): $body//p//img

But the result is not showing the image. FYI, the <img> doesn't have attributes except src.

Sample code:

<p><img src="mysrc"/></p>

I have no idea, please help me


回答1:


The problem with your code is it replaces the <img>.

Like what you've said, you want to replace <p> with <figure>. So replace the tag <p> with <img> children.

@replace_tag(<figure>): $body//p[.//img]

The more simple way is, <figure>: $body//p[.//img]



来源:https://stackoverflow.com/questions/54969371/telegrams-instant-view-api-element-img-is-not-supported-in-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!