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

Code Blocks with Line Numbers Have Styling Issues #168

Open
1 task done
rpoisel opened this issue Jan 18, 2025 · 1 comment
Open
1 task done

Code Blocks with Line Numbers Have Styling Issues #168

rpoisel opened this issue Jan 18, 2025 · 1 comment

Comments

@rpoisel
Copy link
Contributor

rpoisel commented Jan 18, 2025

What is your Hugo Extended Version

hugo v0.140.2-aae02ca612a02e085c08366a9c9279f4abb39d94+extended linux/amd64 BuildDate=2024-12-30T15:01:53Z VendorInfo=gohugoio

What is your Go Version

go version go1.23.5 linux/amd64

What is your Node.js Version

v18.18.1

What is your Operating System

Debian GNU/Linux amd64

Check for Existing Issues

  • I have searched and found no relevant issues.

Expected Behavior

When using line numbers in code blocks like this:

```python { linenos=true, linenostart=1 }
s = "Python syntax highlighting"
print s
```

I would expect that

  • Each code line should be vertically aligned with its corresponding line number, without shifting or misalignment.
  • Enabling line numbers should not alter the visual style of the code block, including font size, padding, margins, or rounded corners.

Steps to Reproduce

  1. Open the elements.md file and enable line numbers for code blocks by adding { linenos=true, linenostart=1 } to their headers.
  2. Render the sample exampleSite using the appropriate rendering command or build process, e.g. hugo serve.
  3. Open the generated Elements post in a web browser and navigate to the sample code listings.
  4. Observe the alignment of the line numbers and the visual style of the code block.

Code Reproduction URL

No response

Additional Information

First of all: thanks for this great template. I really like it a lot! 👍😄

Here is a screenshot of line numbers enabled:

Image

The same snippet without line numbers enabled:

Image

@rpoisel
Copy link
Contributor Author

rpoisel commented Jan 30, 2025

Just found out how to fix this issue: #171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant