Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
之前的首页文章展示逻辑是暴力截取html文档,导致html标签被截断以至于后面的样式显示异常。
主题想要默认展示文章的第一段也很难做到,因为用'\n'作为第一段的分割点不合理,不是所有的markdown第一段都是文字,可能是代码块,可能是表格或者数学公式,当使用暴力截取这些内容的时候就很容易出现样式错误。
#520 这里出现的问题就是table标签被截断导致。
#223 出现的问题同样是因为上面的问题,而不是设置per_page导致,有的人可能第一篇文章没有被截断,而第二篇文章碰巧被截断了,有的人第八篇才被截断而导致。
hexo官方提供了辅助函数strip_html,可以用来处理这个问题。