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

x/tools/cmd/present: incorrect left alignement with .code -numbers #41728

Open
fgm opened this issue Oct 1, 2020 · 0 comments
Open

x/tools/cmd/present: incorrect left alignement with .code -numbers #41728

fgm opened this issue Oct 1, 2020 · 0 comments

Comments

@fgm
Copy link

@fgm fgm commented Oct 1, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15.2 darwin/amd64

Does this issue reproduce with the latest release?

This is the latest release.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env | sort
AR="ar"
CC="clang"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_ENABLED="1"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
CXX="clang++"
GCCGO="gccgo"
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/fgm/Library/Caches/go-build"
GOENV="/Users/fgm/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0g/p780bc554njc4qj110_8rmbr0000gn/T/go-build163305665=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMOD=""
GOMODCACHE="/Users/fgm/src/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/fgm/src/go"
GOPRIVATE=""
GOPROXY="http://localhost:3000,https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
PKG_CONFIG="pkg-config"

What did you do?

What did you expect to see?

On slide 2, the Go code is correctly formatted from a left margin, and uses the official Go listing font from the Go brand guide, page 10 i.e. (font "Go")

What did you see instead?

On slide 2, the width of the line numbers varies, increasing at line 10 because it now has two digits, breaking the alignment of the code.

The font used for the listing is Droid Sans Mono.

Suggested fix

  • Adjust the font-family for the pre selector to start by Go instead of Droid Sans Mono and add a @font-face to load it.
  • Adjust cmd/present/static/styles.css by modifying the rules for the pre.numbers span:before selector.
    Assuming listings on slides and blogs are always less than 100 lines long, just adding width: 1.5em if enough to fix the issue. A completely correct fix would need to adjust column width based on the actual numbers, probably changing the markup.
@gopherbot gopherbot added the Tools label Oct 1, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.