Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #520,#223,修复首页文章展示异常 #533

Merged
merged 1 commit into from
Sep 23, 2022
Merged

fix: #520,#223,修复首页文章展示异常 #533

merged 1 commit into from
Sep 23, 2022

Conversation

cirry
Copy link

@cirry cirry commented Sep 22, 2022

之前的首页文章展示逻辑是暴力截取html文档,导致html标签被截断以至于后面的样式显示异常。
主题想要默认展示文章的第一段也很难做到,因为用'\n'作为第一段的分割点不合理,不是所有的markdown第一段都是文字,可能是代码块,可能是表格或者数学公式,当使用暴力截取这些内容的时候就很容易出现样式错误。
#520 这里出现的问题就是table标签被截断导致。
#223 出现的问题同样是因为上面的问题,而不是设置per_page导致,有的人可能第一篇文章没有被截断,而第二篇文章碰巧被截断了,有的人第八篇才被截断而导致。
hexo官方提供了辅助函数strip_html,可以用来处理这个问题。

@tufu9441 tufu9441 merged commit 716bb88 into tufu9441:master Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants