Skip to content

Fix inline code font-size mismatch within headers#514

Merged
stevenjoezhang merged 6 commits intotheme-next:masterfrom
balloonio:fix-font-size
Dec 24, 2018
Merged

Fix inline code font-size mismatch within headers#514
stevenjoezhang merged 6 commits intotheme-next:masterfrom
balloonio:fix-font-size

Conversation

@balloonio
Copy link
Contributor

@balloonio balloonio commented Dec 16, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

Any inline code within headers will have mismatched font-size. The inline code will have the same font-size as fenced code, whereas it should have adjusted to whatever font-size the header has.
image

Issue Number(s): N/A

What is the new behavior?

The inline code should have adjusted to whatever font-size the header has.
image

How to use?

N/A

Does this PR introduce a breaking change?

  • Yes.
  • No.

@stevenjoezhang
Copy link
Contributor

The font-size set in source/css/_common/scaffolding/base.styl might be overwritten, e.g. at line 142 of source/css/_schemes/Gemini/index.styl.

.post-body {
  h1 {
    font-size: 1.6em;
    border-bottom: 1px solid $body-bg-color;
  }
  h2 {
    font-size: 1.45em;
    border-bottom: 1px solid $body-bg-color;
  }
  h3 {
    font-size: 1.3em;
    if use_seo {
      border-bottom: 1px solid $body-bg-color;
    } else {
      border-bottom: 1px dotted $body-bg-color;
    }
  }
  h4 {
    font-size: 1.2em;
    if use_seo {
      border-bottom: 1px dotted $body-bg-color;
    }
  }
  h5 {
    font-size: 1.07em;
  }
  h6 {
    font-size: 1.03em;
  }
}

Would you like to fix it?

@balloonio
Copy link
Contributor Author

@stevenjoezhang Thanks for pointing it out. I updated the PR to make sure Gemini header code uses the same font-size as header. It seems that Gemini is the only scheme that overrides the post font-size in _common/scaffolding/base.styl. Do you think it deserves a note in the comment in _common/scaffolding/base.styl?

@ivan-nginx ivan-nginx added this to the v6.7.0 milestone Dec 20, 2018
Copy link
Member

@ivan-nginx ivan-nginx left a comment

Choose a reason for hiding this comment

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

Do you think it deserves a note in the comment

I think it's deserves refactoring of Gemini scheme. No note.

@balloonio
Copy link
Contributor Author

Does this need manual merge?

font-size: 1.6em;
border-bottom: 1px solid $body-bg-color;
code {
font-size: 1em;
Copy link
Member

Choose a reason for hiding this comment

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

Mb need to define same em size?
For all headers below too.

Copy link
Contributor Author

@balloonio balloonio Dec 23, 2018

Choose a reason for hiding this comment

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

em | Relative to the font-size of the element (2em means 2 times the size of the current font) source

When setting h1 code font-size, the current font-size is already set to h1's font-size. Therefore, h1 code font-size 1em means relatively the same size as h1's font-size.

Here is my test results using Gemini theme with my fix. First image is the result using 1em. Second image is the result using 1.6em( the same font-size as h1).
image
image

@stevenjoezhang stevenjoezhang merged commit 83da347 into theme-next:master Dec 24, 2018
@1v9 1v9 added the 🌀 Fonts label Aug 13, 2019
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
* Fix inline code font-size mismatch within headers

* Fix the mismatch in Gemini scheme font-size override, and remove empty line to match coding style
wens07 pushed a commit to wens07/hexo-theme-next that referenced this pull request May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants