将Blogger页面添加为Telegram Instant View时,用replace_tag解决a内部不支持img的问题

将Blogger页面添加为Telegram Instant View时,遇到 Element <img> is not supported in <a> 的错误

报错信息示例:

[..after:119] @simplify
Element <img> is not supported in <a>: <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF5Km8RG7WQw6aKDRVJdFno0hPg_m63nPEhO2beAVZvKtBNgdYecEOyKTyA6CFhrtaWc5c6BqWq2friOctVX2nI7IzjtBI9sTwFxw0N1P_S2DrZIIg5KBBKZ1X-p-IMjbHfywbRWQt1x_nzIh3KO9Rj2bRsr8SreJmxp4HWQnlvrTTykQ2KsOoVJqu/s16000/2022-05-31_23-56-43.jpg"/>

解决方案:

# 将`<a>`和`<p>`标签下的`<img>`标签替换为`<figure>`,使子标签下的 <img> 正常显示
@replace_tag(<figure>): //a[.//img]
@replace_tag(<figure>): //p[.//img]

感谢:

https://www.10101.io/2019/05/23/telegtam-instant-view 

评论

The Hot3 in Last 30 Days