github-style icon indicating copy to clipboard operation
github-style copied to clipboard

Discussion of Features: Custom styles for syntax highlighting and optimization of the TOC structure

Open QingZ11 opened this issue 4 months ago • 0 comments

I used Claude to implement some custom styles. I'm not sure if you need them. Since I'm not a front-end developer, the code Claude implemented was only for functional verification, and I asked it to maintain your coding style. If you need it, I can submit the PRs one by one.

The first one: setting the font color and background color for highlighted parts.

The implemented features include:

  1. Corresponding variables for both dark and light modes.
Image Image
  1. In dark mode, a separate color is set for title-type text in articles, which is not done in light mode (I personally think the color contrast in light mode is sufficient).

The second one: optimizing the table of contents (TOC) presentation style.

I personally feel that a post's TOC is very important. The style currently implemented by github-style is a pop-up box that appears on click, rather than being fixed in a certain position. The features Claude implemented include:

  1. It is fixed on the right side of the post by default when the post is opened.
  2. The different levels of headings in the article are displayed with indentation according to their hierarchy, and they use the list style from github-style.
  3. The right-side menu can be closed by clicking the content close button or the TOC button in the post header.
Image Image

However, there are some outstanding issues here:

  1. A fixed right-side column isn't very friendly to narrow screens. It needs to be handled separately for narrow screens, such as the TOC style for iPads and phones. My current idea is to use the fixed TOC mode for devices with a width over 2560 px; for devices below 2560 px, the original design would be retained. To maintain style consistency, the original TOC design will also incorporate list style and chapter-level indentation.

This outstanding issue has not been dealt with yet because I don't know if you need this feature. If you do, I will process and verify it before submitting a PR.

The third one: variable comments for dark.css and light.css.

I haven't had Claude process these variable comments yet because I don't know if you need this feature. My personal thought is that with variable comments, it would be more convenient for users to customize things. Of course... perhaps for other users, understanding the purpose of your github-style code's variables isn't a problem, so they naturally wouldn't need any comments.


我用 Claude 实现了一些定制化样式设计,不知道你这边需不需要。因为我不会写前端代码,Claude 实现的代码只做了效果功能验证,并让它保留了你的代码风格。如果需要的话,我一个个提交 pr 过来。

第一个:高亮部分的字体颜色和背景色设定

实现的功能有:

  1. 暗黑和 light 模式都有对应的变量;
Image Image
  1. 暗黑模式下,单独对文章的标题型文字进行颜色设置,light 模式下不处理(个人觉得 light 模式的颜色对比度够了);

第二个:优化目录结构呈现样式。

个人觉得一篇 post 的目录结构还是很重要的,目前 github-style 实现的样式是点击之后弹出一个框,并不是置顶在某个位置。Claude 实现的功能有:

  1. 打开 post 后,默认固定在 post 的右侧边;

  2. 文章各级标题按照层级进行缩进展示,并引用 github-style 的列表样式进行展示;

  3. 点击 content 关闭按钮或者 post-header 的 toc 按钮可关闭右侧菜单栏;

Image Image

但是,这里有部分遗留问题:

  1. 固定右侧栏的话,对窄屏幕不是很友好,需要单独处理窄屏,例如:iPad 和手机尺寸的 toc 样式。目前想法是,宽度超过 2560 px 的设备用固定目录结构模式;低于 2560 px 的设备沿用原选你的设计。为了保持样式统一,原先的目录结构设计会加入列表样式表章节层级缩进。

这个遗留问题尚未开始处理,因为我不知道你是否需要这个功能。如果你需要的话,我这边会处理验证之后,再进行 pr 提交。

第三个:dark.css 和 light.css 的变量注释。

这个变量注释目前还没让 Claude 处理,因为我不知道你是否需这个功能。个人想法是,有变量注释的情况下,会更方便用户进行定制化——当然。。。或许对其他用户而言,读你的 github-style 代码理解变量作用不是什么问题,自然也不需要什么注释。

QingZ11 avatar Aug 21 '25 04:08 QingZ11