Skip to content

Fix font-size in inline code comment preview #35209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v1.24 This PR should be backported to Gitea 1.24 lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/frontend type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants