Skip to content

Commit

Permalink
Fix square corners on line numbers when code is collapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 3, 2024
1 parent 55bc638 commit 7157f98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ ul.block, .block li {
}

.rustdoc .example-wrap > pre,
.rustdoc .scraped-example .src-line-numbers {
.rustdoc .scraped-example .src-line-numbers,
.rustdoc .scraped-example .src-line-numbers > pre {
border-radius: 6px;
}

Expand All @@ -755,7 +756,8 @@ If the code example line numbers are displayed, there will be a weird radius in
both the code example and the line numbers, so we need to remove the radius in this case.
*/
.rustdoc .example-wrap > .example-line-numbers,
.rustdoc .scraped-example .src-line-numbers {
.rustdoc .scraped-example .src-line-numbers,
.rustdoc .scraped-example .src-line-numbers > pre {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc-gui/docblock-code-block-line-number.goml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ assert-local-storage: {"rustdoc-line-numbers": "true" }
// Same check with scraped examples line numbers.
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"

assert-css: (
".scraped-example .src-line-numbers > pre",
{
// There should not be a radius on the right of the line numbers.
"border-top-left-radius": "6px",
"border-bottom-left-radius": "6px",
"border-top-right-radius": "0px",
"border-bottom-right-radius": "0px",
},
ALL,
)
assert-css: (
".scraped-example .src-line-numbers",
{
Expand Down

0 comments on commit 7157f98

Please sign in to comment.