Merge pull request #755 from readthedocs/fix-752

Scope autodoc styling to .class and .data for Sphinx 2.0
This commit is contained in:
Jesse Tan 2019-07-04 20:02:12 +02:00 committed by GitHub
commit f237820d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 46 deletions

View File

@ -11,6 +11,8 @@ New Features
Fixes Fixes
----- -----
* Fix definition lists looking different with Sphinx 2.0+
Other Changes Other Changes
-------------- --------------

View File

@ -323,54 +323,56 @@
// This makes me terribly unhappy and makes this code very nesty. Unfortunately I've seen hand-written docs // This makes me terribly unhappy and makes this code very nesty. Unfortunately I've seen hand-written docs
// that output similar, but not quite the same nesting so this is really the best we can do. // that output similar, but not quite the same nesting so this is really the best we can do.
dl:not(.docutils) dl:not(.docutils)
margin-bottom: $base-line-height // In Sphinx 2.0+ most DLs no longer contain .docutils, needs tighter scoping using next line
// This would be the equivilant of a .. class:: &.class, &.data
dt margin-bottom: $base-line-height
display: table // This would be the equivilant of a .. class::
margin: $base-line-height / 4 0 dt
font-size: 90% display: table
line-height: normal margin: $base-line-height / 4 0
background: lighten($class-color, 50%) font-size: 90%
color: $class-color line-height: normal
border-top: solid 3px lighten($class-color, 20%) background: lighten($class-color, 50%)
padding: $base-line-height / 4 color: $class-color
position: relative border-top: solid 3px lighten($class-color, 20%)
&:before padding: $base-line-height / 4
color: lighten($class-color, 20%) position: relative
.headerlink &:before
color: $text-color color: lighten($class-color, 20%)
font-size: 100% !important .headerlink
// And this would be the .. method:: color: $text-color
dl dt font-size: 100% !important
margin-bottom: $base-line-height / 4 // And this would be the .. method::
border: none dl dt
border-left: solid 3px hsl(0,0%,80%) margin-bottom: $base-line-height / 4
background: hsl(0,0%,94%)
color: $method-color
.headerlink
color: $headerlink-color
font-size: 100% !important
dt:first-child
margin-top: 0
// Since dts get the callout style, we treat this less as callouts.
tt, code
font-weight: bold
&.descname, &.descclassname
background-color: transparent
border: none border: none
padding: 0 border-left: solid 3px hsl(0,0%,80%)
font-size: 100% !important background: hsl(0,0%,94%)
&.descname color: $method-color
.headerlink
color: $headerlink-color
font-size: 100% !important
dt:first-child
margin-top: 0
// Since dts get the callout style, we treat this less as callouts.
tt, code
font-weight: bold font-weight: bold
// This is for more advanced parameter control &.descname, &.descclassname
.optional background-color: transparent
display: inline-block border: none
padding: 0 4px padding: 0
color: $black font-size: 100% !important
font-weight: bold &.descname
.property font-weight: bold
display: inline-block // This is for more advanced parameter control
padding-right: 8px .optional
display: inline-block
padding: 0 4px
color: $black
font-weight: bold
.property
display: inline-block
padding-right: 8px
// Doc links to sourcecode // Doc links to sourcecode
.viewcode-link, .viewcode-back .viewcode-link, .viewcode-back
display: inline-block display: inline-block