Skip to content
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

[BUG] On iOS mobile phone, the code block font size is not the same #828

Closed
DejavuMoe opened this issue Mar 13, 2022 · 8 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@DejavuMoe
Copy link
Contributor

DejavuMoe commented Mar 13, 2022

Describe the bug

  • Device/Os: iPhone 13/iOS 15.3.1
  • Type: Mobile
  • Browser and version: Safari & Google Chrome v99.0.4844.59
  • Hugo Version: 0.93.3
  • Theme Version: 80928d9f2327809b7ecccf36930e4b726a7d10b2

Steps to reproduce the behavior:

  1. Open Safari or Chrome browser
  2. Visit my website at www.dejavu.moe (using the awesome PaperMod, thanks for your work)
  3. Open any post with a long block of code ( example 1, example 2 )
  4. find that the font size of the code is not consistent, some are very large, some are small

Expected behavior:

Access to the code block font size on mobile devices (cell phones) browsers remains essentially the same size

Screenshots
IMG_1501
IMG_1502

Additional context

I'm not sure if it's the same problem as #695

The issue does not repeat on another iPad Pro 11 with iPadOS 15.3.1

My Hugo config.yml:

assets:
    disableHLJS: true

markup:
    highlight:
        #anchorLineNos: true
        codeFences: true 
        guessSyntax: false 
        lineNos: false 
        noClasses: false 
        style: dracula

code highlighting css:

image

@DejavuMoe DejavuMoe added the bug Something isn't working label Mar 13, 2022
@adityatelange adityatelange added the help wanted Extra attention is needed label Mar 13, 2022
@DejavuMoe
Copy link
Contributor Author

I don't have a macbook so it's hard for me to connect my phone via USB cable for web debugging, but I found a project remotedebug-ios-webkit-adapter that should allow remote debugging of web pages on mobile phones in Windows OS

Temporary workaround :

Once I stopped using Hugo's syntax highlighter Chroma:

params:
    assets:
        disableHLJS: true

and fallback code block highlighted as default configuration:

markup:
   # highlight:
   # anchorLineNos: true
   # codeFences: true
   # guessSyntax: true
   # lineNos: true
   # noClasses: false
   # style: monokai

Screenshots:

IMG_1522
IMG_1523

@adityatelange
Copy link
Owner

Excellent

@adityatelange
Copy link
Owner

@DejavuMoe Can we close this if this issue is now sorted?

@DejavuMoe
Copy link
Contributor Author

@DejavuMoe Can we close this if this issue is now sorted?

There is no better solution for the time being, so let's close it for the time being🤔

Thank you for your work.

@adityatelange
Copy link
Owner

@DejavuMoe you can head over to Hugo forums and let them know about this, imo this isn't theme side bug and totally depends on chroma syntax highlighter

@DejavuMoe
Copy link
Contributor Author

@DejavuMoe you can head over to Hugo forums and let them know about this, imo this isn't theme side bug and totally depends on chroma syntax highlighter

OK,thanks

@tabletcorry
Copy link

tabletcorry commented Apr 6, 2022

Also seeing this bug. The workaround that I found was to remove a code type from my code blocks. Disabling HLJS had no effect at all.

Specifically, the use of HCL code highlighting appears to break the code size. Perhaps an interaction between HLJS (which does not support HCL) and Chroma (which does)?

Once the HCL highlighting is removed, the JS highlighting switches from having the same bug, to being rendered correctly.

@bglw
Copy link

bglw commented Jul 1, 2022

Hi all,

This bug can be traced back to this iOS issue with flex and font sizing: https://stackoverflow.com/questions/38346494/why-is-flex-affecting-font-size-on-ios

Adding the following styles to your site will fix this bug and allow to you use the default Chroma highlighting in Hugo:

/* Fixes iOS font sizing anomaly */
code {
    text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

mdb added a commit to mdb/mdb.github.io that referenced this issue Nov 16, 2022
After many calories burned, the solution was just a Google away:
adityatelange/hugo-PaperMod#828 (comment)

...just gotta find the right Google words, evidently.
brainsik added a commit to brainsik/hugo-theme-m10c that referenced this issue Jan 6, 2023
More details about the issue and fix can be found here:
adityatelange/hugo-PaperMod#828
vaga pushed a commit to vaga/hugo-theme-m10c that referenced this issue Jan 7, 2023
More details about the issue and fix can be found here:
adityatelange/hugo-PaperMod#828

Co-authored-by: jeremy avnet <brainsik@users.noreply.github.com>
otera pushed a commit to otera/hugo-theme-m10c that referenced this issue Mar 2, 2023
More details about the issue and fix can be found here:
adityatelange/hugo-PaperMod#828

Co-authored-by: jeremy avnet <brainsik@users.noreply.github.com>
jacobjmarks added a commit to jacobjmarks/thoughts that referenced this issue Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants