Skip to content

Commit

Permalink
feat: 长文章优化可关闭,校准容器数值
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 committed Feb 28, 2023
1 parent 17f3552 commit 716ebd2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ experiments:
debug: false # 使用debug模式启动
disableThemeComment: false # 禁用主题评论系统(一般用于关闭评论或让插件接管评论系统)
usingRelative: false # _image.yml 使用相对路径
optimizeLongPosts: false # 优化长文章,这能让长文章的FPS提升70%-150%并解决假死问题,但存在一些副作用

# 优化性能区
performance:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-shokax",
"version": "0.2.0-rc3",
"version": "0.2.0-rc4",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/zkz098/hexo-theme-shokaX",
Expand Down
7 changes: 0 additions & 7 deletions source/css/_common/components/post/expand.styl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@
}
}

span, p, pre {
content-visibility: auto;
contain-intrinsic-size: 979px 1em;
}

ul, dd, ol {
content-visibility: auto;
contain-intrinsic-size: 979px 3.5em;
ul, ol {
margin-top: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions source/css/app.styl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ if $custom = hexo-config('style.custom')
for $inject_style in hexo-config('injects.style')
@import $inject_style;

if $optimize = hexo-config('experiments.optimizeLongPosts')
@import "optimize.styl"

6 changes: 6 additions & 0 deletions source/css/optimize.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.md {
span:not(.katex), p, pre, li, a {
content-visibility: auto;
contain-intrinsic-size: auto 1em;
}
}

1 comment on commit 716ebd2

@vercel
Copy link

@vercel vercel bot commented on 716ebd2 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.