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

Align code-block line numbers to the right #96

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Any non-code changes should be prefixed with `(docs)`.
See `PUBLISH.md` for instructions on how to publish a new version.
-->

- (patch) Align code-block line numbers to the right

## v1.12.2 - 081867e

Expand Down
24 changes: 23 additions & 1 deletion styles/_code_prefix.scss
MSzabi marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 DigitalOcean
Copyright 2024 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License") !default;
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,6 +51,28 @@ pre {
&::before {
border-right: 1px solid rgba($white, 0.5);
padding-right: 5px;
text-align: right;
width: 2ch;
}

&:first-child:nth-last-child(n + 10)::before,
&:first-child:nth-last-child(n + 10) ~ li::before {
width: 3ch;
}

&:first-child:nth-last-child(n + 100)::before,
&:first-child:nth-last-child(n + 100) ~ li::before {
width: 4ch;
}

&:first-child:nth-last-child(n + 1000)::before,
&:first-child:nth-last-child(n + 1000) ~ li::before {
width: 5ch;
}

&:first-child:nth-last-child(n + 10000)::before,
&:first-child:nth-last-child(n + 10000) ~ li::before {
width: 6ch;
}
}
}
Expand Down