Skip to content

Commit 62dcf2b

Browse files
j-f1Thibaut
authored andcommitted
Don't overlay the method's source over its docs in RDoc
1 parent efdd52a commit 62dcf2b

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

assets/stylesheets/pages/_rdoc.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,8 @@
3333
}
3434
}
3535

36-
.method-description { position: relative; }
37-
3836
.method-source-code {
3937
display: none;
40-
position: absolute;
41-
z-index: 1;
42-
top: 0;
43-
left: -1em;
44-
right: 0;
45-
background: var(--contentBackground);
46-
box-shadow: 0 1em 1em 1em var(--contentBackground);
4738

4839
> pre { margin: 0; }
4940
}

lib/docs/filters/rdoc/clean_html.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def other
3737
end
3838

3939
# Add class to differentiate Ruby code from C code
40-
css('.method-source-code > pre').each do |node|
41-
node['class'] = node.at_css('.ruby-keyword') ? 'ruby' : 'c'
40+
css('.method-source-code').each do |node|
41+
node.parent.prepend_child(node)
42+
pre = node.at_css('pre')
43+
pre['class'] = pre.at_css('.ruby-keyword') ? 'ruby' : 'c'
4244
end
4345

4446
# Remove code highlighting

0 commit comments

Comments
 (0)