Skip to content

Commit 4f8b62a

Browse files
committed
CSS: update handling of admonition titles
Use CSS class "admonition-title" instead of "first" and "last". Fixes #176.
1 parent db81fe0 commit 4f8b62a

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/nbsphinx.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -476,21 +476,6 @@
476476
margin-top: -19px;
477477
}
478478
479-
/* nice headers on first paragraph of info/warning boxes */
480-
.admonition .first {
481-
margin: -12px;
482-
padding: 6px 12px;
483-
margin-bottom: 12px;
484-
color: #fff;
485-
line-height: 1;
486-
display: block;
487-
}
488-
.admonition.warning .first {
489-
background: #f0b37e;
490-
}
491-
.admonition.note .first {
492-
background: #6ab0de;
493-
}
494479
.admonition > p:before {
495480
margin-right: 4px; /* make room for the exclamation icon */
496481
}
@@ -501,7 +486,7 @@
501486
502487
/* nicer titles and more space for info and warning logos */
503488
504-
div.admonition > .first {
489+
div.admonition p.admonition-title {
505490
background: rgba(0, 0, 0, .05);
506491
margin: .5em -1em;
507492
margin-top: -.5em !important;
@@ -1399,12 +1384,11 @@ def depart_code_latex(self, node):
13991384

14001385
def visit_admonition_html(self, node):
14011386
self.body.append(self.starttag(node, 'div'))
1402-
self.set_first_last(node)
1403-
if self.settings.env.config.html_theme in ('sphinx_rtd_theme', 'julia'):
1404-
if node.children:
1405-
classes = node.children[0]['classes']
1406-
if 'last' not in classes:
1407-
classes.extend(['fa', 'fa-exclamation-circle'])
1387+
if len(node.children) >= 2:
1388+
node[0]['classes'].append('admonition-title')
1389+
html_theme = self.settings.env.config.html_theme
1390+
if html_theme in ('sphinx_rtd_theme', 'julia'):
1391+
node.children[0]['classes'].extend(['fa', 'fa-exclamation-circle'])
14081392

14091393

14101394
def depart_admonition_html(self, node):

0 commit comments

Comments
 (0)