Telegram 的即时视图 API:Element <img>&lt;p&gt; 不支持 [英] Telegram&#39;s instant view API: Element &lt;img&gt; is not supported in &lt;p&gt;

查看:25
本文介绍了Telegram 的即时视图 API:Element <img>&lt;p&gt; 不支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试创建 Telegram 的 Instant View 模板时遇到问题,出现此错误:

元素 <p> 不支持:<img src="mysrc"/>

所以,我决定用

标签替换标签

如果有 标签>

@replace_tag(

): $body//p//img

但结果没有显示图像.仅供参考, 除了 src 之外没有其他属性.

示例代码:

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

我不知道,请帮帮我

解决方案

你的代码的问题是它取代了 .

就像你说的,你想用

替换

.因此,将标签

替换为 子项.

@replace_tag(

): $body//p[.//img]

更简单的方法是,

: $body//p[.//img]

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

解决方案

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]

这篇关于Telegram 的即时视图 API:Element <img>&lt;p&gt; 不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆