Skip to content

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Aug 4, 2025

Previously, when writing a inline code comment, the markup preview would have incorrect font size of 16px. This fixes it to 14px and also combines similar CSS rules into one.

I'm not a fan of this selector complexity, but it seems like a necessity because standalone markup files render at 16px while comments render at 14px.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 4, 2025
@silverwind silverwind added backport/v1.24 This PR should be backported to Gitea 1.24 type/bug and removed modifies/frontend labels Aug 4, 2025
@wxiaoguang
Copy link
Contributor

because standalone markup files render at 16px while comments render at 14px.

Then you could just use 16px for .file-view.markup and remove all other selectors&styles to use default 14px.

@silverwind
Copy link
Member Author

silverwind commented Aug 4, 2025

because standalone markup files render at 16px while comments render at 14px.

Then you could just use 16px for .file-view.markup and remove all other selectors&styles to use default 14px.

Hmm yeah probably the better alternative. I'm not aware of any other places that render markup as 16px, but there could be some that I missed.

@silverwind
Copy link
Member Author

Tested it in repo file view and readme, they both render as expected 16px while all other places (comments) render 14px.

@@ -1,6 +1,6 @@
.markup {
overflow: hidden;
font-size: 16px;
font-size: 14px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should remove this and use the parent's font-size.

Body's default font-size is also 14px IIRC.

Copy link
Member Author

Choose a reason for hiding this comment

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

We have html, body {font-size: 14px}, yes. But I'm not confident that inheriting wouldn't break anything. I think it's better to explicitely specify 14px/16px than to rely on potentially incorrect surrounding content.

Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: silverwind <me@silverwind.io>
@silverwind silverwind changed the title Fix font-size in inline comment preview Fix font-size in inline code comment preview Aug 4, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 6, 2025
@silverwind silverwind removed the backport/v1.24 This PR should be backported to Gitea 1.24 label Aug 11, 2025
@silverwind
Copy link
Member Author

Not backporting this one, but I think it's good to keep explicit font sizes.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 12, 2025
@lafriks lafriks enabled auto-merge (squash) August 12, 2025 08:05
@lafriks lafriks merged commit e02b47d into go-gitea:main Aug 12, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.25.0 milestone Aug 12, 2025
@silverwind silverwind deleted the markupfont branch August 12, 2025 08:39
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 19, 2025
* giteaofficial/main:
  Refactor smal code snippeds in models/issues/pull.go  (go-gitea#35301)
  fix: remove duplicate IDs (go-gitea#35210)
  Add start time on perf trace because it seems some steps haven't been recorded. (go-gitea#35282)
  nix dev shell add zip (go-gitea#35300)
  [skip ci] Updated translations via Crowdin
  Fix LFS range size header response (go-gitea#35277)
  Skip "parentsigned" check when the repo is empty (go-gitea#35292)
  [skip ci] Updated translations via Crowdin
  Fix GitHub release assets URL validation (go-gitea#35287)
  nix flake use go1.25 (go-gitea#35288)
  go1.25.0 (go-gitea#35262)
  fix nix dev shell on darwin (go-gitea#35278)
  Fix token lifetime, closes go-gitea#35230 (go-gitea#35271)
  OneDev migration: fix broken migration caused by various REST API changes in OneDev 7.8.0 and later (go-gitea#35216)
  [skip ci] Updated translations via Crowdin
  Fix font-size in inline code comment preview (go-gitea#35209)
  Fix a bug where lfs gc never worked. (go-gitea#35198)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants