Skip to content

Commit f237820

Browse files
authored
Merge pull request #755 from readthedocs/fix-752
Scope autodoc styling to .class and .data for Sphinx 2.0
2 parents 020f5a4 + 0f8268b commit f237820

File tree

2 files changed

+50
-46
lines changed

2 files changed

+50
-46
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ New Features
1111
Fixes
1212
-----
1313

14+
* Fix definition lists looking different with Sphinx 2.0+
15+
1416
Other Changes
1517
--------------
1618

sass/_theme_rst.sass

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -323,54 +323,56 @@
323323
// This makes me terribly unhappy and makes this code very nesty. Unfortunately I've seen hand-written docs
324324
// that output similar, but not quite the same nesting so this is really the best we can do.
325325
dl:not(.docutils)
326-
margin-bottom: $base-line-height
327-
// This would be the equivilant of a .. class::
328-
dt
329-
display: table
330-
margin: $base-line-height / 4 0
331-
font-size: 90%
332-
line-height: normal
333-
background: lighten($class-color, 50%)
334-
color: $class-color
335-
border-top: solid 3px lighten($class-color, 20%)
336-
padding: $base-line-height / 4
337-
position: relative
338-
&:before
339-
color: lighten($class-color, 20%)
340-
.headerlink
341-
color: $text-color
342-
font-size: 100% !important
343-
// And this would be the .. method::
344-
dl dt
345-
margin-bottom: $base-line-height / 4
346-
border: none
347-
border-left: solid 3px hsl(0,0%,80%)
348-
background: hsl(0,0%,94%)
349-
color: $method-color
350-
.headerlink
351-
color: $headerlink-color
352-
font-size: 100% !important
353-
dt:first-child
354-
margin-top: 0
355-
// Since dts get the callout style, we treat this less as callouts.
356-
tt, code
357-
font-weight: bold
358-
&.descname, &.descclassname
359-
background-color: transparent
326+
// In Sphinx 2.0+ most DLs no longer contain .docutils, needs tighter scoping using next line
327+
&.class, &.data
328+
margin-bottom: $base-line-height
329+
// This would be the equivilant of a .. class::
330+
dt
331+
display: table
332+
margin: $base-line-height / 4 0
333+
font-size: 90%
334+
line-height: normal
335+
background: lighten($class-color, 50%)
336+
color: $class-color
337+
border-top: solid 3px lighten($class-color, 20%)
338+
padding: $base-line-height / 4
339+
position: relative
340+
&:before
341+
color: lighten($class-color, 20%)
342+
.headerlink
343+
color: $text-color
344+
font-size: 100% !important
345+
// And this would be the .. method::
346+
dl dt
347+
margin-bottom: $base-line-height / 4
360348
border: none
361-
padding: 0
362-
font-size: 100% !important
363-
&.descname
349+
border-left: solid 3px hsl(0,0%,80%)
350+
background: hsl(0,0%,94%)
351+
color: $method-color
352+
.headerlink
353+
color: $headerlink-color
354+
font-size: 100% !important
355+
dt:first-child
356+
margin-top: 0
357+
// Since dts get the callout style, we treat this less as callouts.
358+
tt, code
364359
font-weight: bold
365-
// This is for more advanced parameter control
366-
.optional
367-
display: inline-block
368-
padding: 0 4px
369-
color: $black
370-
font-weight: bold
371-
.property
372-
display: inline-block
373-
padding-right: 8px
360+
&.descname, &.descclassname
361+
background-color: transparent
362+
border: none
363+
padding: 0
364+
font-size: 100% !important
365+
&.descname
366+
font-weight: bold
367+
// This is for more advanced parameter control
368+
.optional
369+
display: inline-block
370+
padding: 0 4px
371+
color: $black
372+
font-weight: bold
373+
.property
374+
display: inline-block
375+
padding-right: 8px
374376
// Doc links to sourcecode
375377
.viewcode-link, .viewcode-back
376378
display: inline-block

0 commit comments

Comments
 (0)