Skip to content

改进代码块行号自适应 #4651

Closed
Closed
@Zuoqiu-Yingyi

Description

@Zuoqiu-Yingyi
Contributor

描述问题 Describe the problem

REF: v0.7.3 版本代码行号显示错误 · Issue #15 · Zuoqiu-Yingyi/siyuan-theme-dark-plus

经过测试发现为原生主题样式问题
image

由于代码块行号栏宽度固定, 导致使用较大字号(36px)时行数超过 100 即出现换行

期待的结果 Expected result

调整代码行号与内容的宽度单位为 em, 2.5em 宽度经测试在任意字号下都可以显示 9999 行以内的代码

.protyle-linenumber__rows {
    width: 2.5em;
}
.protyle-linenumber {
    padding-left: calc(2.5em + 4px) !important;
}

image

截屏或者录屏演示 Screenshot or screen recording presentation

版本环境 Version environment

  • Version: 2.0.0-b1

Activity

changed the title [-]调整编辑区字号后代码块行号宽度固定导致行号发生换行[/-] [+]编辑区字号较大时代码块行号宽度固定导致行号发生换行[/+] on Apr 20, 2022
Vanessa219

Vanessa219 commented on Apr 20, 2022

@Vanessa219
Member

这样的话,字体更大的情况也无法显示。可能需要把字体的行号固定了才行

changed the title [-]编辑区字号较大时代码块行号宽度固定导致行号发生换行[/-] [+]固定代码块行号字体大小[/+] on Apr 20, 2022
Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 20, 2022

@Zuoqiu-Yingyi
ContributorAuthor

这样的话,字体更大的情况也无法显示。可能需要把字体的行号固定了才行

em 单位会随字号变化呀

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 20, 2022

@Zuoqiu-Yingyi
ContributorAuthor

不过行号的字体使用 --b3-font-family-code 字体族比较好, 毕竟等宽

Vanessa219

Vanessa219 commented on Apr 20, 2022

@Vanessa219
Member

是哦,傻了。。。🤦‍♀️

self-assigned this
on Apr 20, 2022
changed the title [-]固定代码块行号字体大小[/-] [+]改进代码块行号自适应[/+] on Apr 20, 2022
added this to the 2.0.0 milestone on Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Vanessa219@Zuoqiu-Yingyi

      Issue actions

        改进代码块行号自适应 · Issue #4651 · siyuan-note/siyuan