lxndrblz / anatole

Anatole is a minimalistic two-column theme for Hugo.
https://themes.gohugo.io/themes/anatole/
MIT License
657 stars 362 forks source link

Use monospace font for code blocks #406

Closed ericswpark closed 1 year ago

ericswpark commented 1 year ago

Describe the bug Because the current font used within code blocks has variable width, it messes up formatting if lines reference each other, such as output from a compiler highlighting a bug within a line, for example.

To Reproduce Steps to reproduce the behavior:

  1. Create a code block
  2. View in browser

Expected behavior Code blocks should not use variable width font

Screenshots Red arrows indicate where the caret should've been shown: 3DB7F7C3-FCE4-4B5E-88F3-D862E2C18E48

lxndrblz commented 1 year ago

This issue seems to be related to issue #346.

mike-kfed commented 1 year ago

I fixed the problem by replacing the wildcard * {} selector with body {} in assets/scss/partials/_base.scss. Since I don't know why wildcard is used in the first place I am not sending a PR, this potentially breaks other stuff, works for me however :)

lxndrblz commented 1 year ago

@mike-kfed That's a good observation. Would you mind sending a PR with your changes? I could then verify if it has any other side effects or what's the best approach of resolving this quite annoying issue.

xjasonlyu commented 1 year ago

For anyone who needs it, here's a temporary workaround:

* {
    font-family: inherit;
}

body {
    font-family: 'PingHei', 'PingFang SC', 'Helvetica Neue', 'Work Sans', 'Hiragino Sans GB', sans-serif;
}