.1602452971339523:1fd738d0776293b7b4f15a29567f732f_69eca58f07e58165d706b0cb.69ecb18596939c95cd758f77.69ecb184e106f08a795a787e:Trae CN.T(2026/4/25 20:20:21)#3
Open
666yuhan666 wants to merge 2 commits intomainfrom
Conversation
添加两个移动端布局测试页面(test-mobile-layout.html和test-mobile-layout-improved.html)用于测试不同屏幕尺寸下的显示效果 新增github-markdown-mobile.css样式文件,包含针对移动设备的优化样式
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
新增功能
为 github-markdown-css 添加可配置的 Compact(紧凑)阅读模式,适合小屏幕设备或需要展示更多内容的场景。
实现方式
1. CSS 变量定义
在
.markdown-body根部定义 5 个间距变量,默认值与原样式保持一致(向后兼容):--spacing-heading-top--spacing-heading-bottom--spacing-paragraph-bottom--spacing-block-bottom--spacing-list-padding2.
.compact类通过
.markdown-body.compact类覆盖变量为更小的值:3. 变量替换
将 CSS 中硬编码的间距值替换为变量引用,确保:
.compact类时,样式与之前完全一致.compact类时,应用紧凑间距使用方式
方式 1:使用 Compact 类
方式 2:自定义间距(更灵活)
修改文件
github-markdown.cssreadme.mdtest-compact-mode.html兼容性
.compact类时,样式完全不变