Comments (3)
我有一个解决办法,就是将<pre>
标签去掉,只留下<code>
,并且将<code>
标签中的\r\n
换为<p>\n</p>
,这样解决了<code>
标签中多行代码显示为一行的问题。具体方法是改写小程序中 detail.js
中获取文章内容并交给 wxParse
处理的函数:
WxParse.wxParse('article', 'html', response.data.content.rendered.replace(/<pre>/g, "").replace(/<\/pre>/g, "").replace(/\r\n(?!<\/code>)/g,"<p>\n<\/p>"), self, 5);
我也是刚刚解决这个问题,随后我会写篇博文来具体说明。
from winxin-app-watch-life.net.
这个思路不错
from winxin-app-watch-life.net.
哇,感谢作者的认同,今天把这个问题的解决方法总结成一篇博文,地址:解决 WordPress 微信小程序文章内代码显示、图片非 CDN 地址、图片附带链接的问题
同时还解决了其他一些问题,希望能帮到需要的人。
from winxin-app-watch-life.net.
Related Issues (20)
- 点击主页文章列表,跳转详情页detail.js:431 报错 HOT 1
- 文章详情消失了部分内容 HOT 1
- ram-util中time_tran($the_time)函数中计算时间可能是有问题的 HOT 1
- 登录失败 HOT 9
- 关于激励广告,能直接通过抓包获取到内容。 HOT 1
- 文章无图片时搜索列表页、类目页的文章列表图片均不能显示 HOT 1
- 用的百度云加速,获取不了文章json,老提示502,无解了 HOT 1
- 小程序申请上线失败,个人主体,请问是什么原因呢? HOT 1
- 这个网站地址是从哪里来的呢 HOT 1
- 文章设置分类后,小程序无法显示
- 文章设置分类后,小程序无法显示 HOT 1
- 点击“喜欢” 后,小程序崩溃 HOT 1
- 打包app,首页无内容 HOT 1
- wordpress用户绑定 HOT 1
- 小程序后台服务器设置 HOT 1
- 最新版小程序编译后报错 如图 HOT 1
- scss兼容bug HOT 1
- 请问ui.scss无法导入如何解决? HOT 3
- 与jwt-auth插件冲突,导致小程序无法获取文章信息 HOT 1
- 用了个文章隐藏的插件,文章隐藏后小程序首页不展示,但是排行榜里依然展示,估计是没有过滤到字段 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winxin-app-watch-life.net.