Skip to content

Commit ab93398

Browse files
authored
Admonition EPUB styles (#1793)
1 parent 3e9358c commit ab93398

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

assets/css/_epub.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import 'custom-props/common.css';
22
@import 'custom-props/theme-light.css';
33

4+
@import 'content/epub-admonition.css';
45
@import 'content/code.css';
56
@import 'content/functions.css';
67
@import 'screen-reader.css';
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.content-inner blockquote:is(.warning, .error, .info, .neutral, .tip) {
2+
border-left: solid 4px;
3+
color: var(--black);
4+
font-size: 0.9em;
5+
line-height: 1.4em;
6+
margin-bottom: 1.5em;
7+
margin-left: 5px;
8+
padding: 7px 15px;
9+
page-break-inside: avoid;
10+
}
11+
12+
.content-inner blockquote.warning {
13+
background-color: var(--warningBackground);
14+
border-left-color: var(--warningHeadingBackground);
15+
}
16+
17+
.content-inner blockquote.error {
18+
background-color: var(--errorBackground);
19+
border-left-color: var(--errorHeadingBackground);
20+
}
21+
22+
.content-inner blockquote.info {
23+
background-color: var(--infoBackground);
24+
border-left-color: var(--infoHeadingBackground);
25+
}
26+
27+
.content-inner blockquote.neutral {
28+
background-color: var(--neutralBackground);
29+
border-left-color: var(--neutralHeadingBackground);
30+
}
31+
32+
.content-inner blockquote.tip {
33+
background-color: var(--tipBackground);
34+
border-left-color: var(--tipHeadingBackground);
35+
}
36+
37+
.content-inner blockquote :is(h3, h4) {
38+
font-weight: bold;
39+
margin: 0px 10px 5px 0px;
40+
}
41+
42+
.content-inner blockquote :is(h3, h4):is(.warning, .error, .info, .neutral, .tip) {
43+
font-style: normal;
44+
font-weight: 700;
45+
}
46+
47+
.content-inner blockquote :is(h3, h4).warning {
48+
color: var(--warningHeadingBackground);
49+
}
50+
.content-inner blockquote :is(h3, h4).error {
51+
color: var(--errorHeadingBackground);
52+
}
53+
.content-inner blockquote :is(h3, h4).info {
54+
color: var(--infoHeadingBackground);
55+
}
56+
.content-inner blockquote :is(h3, h4).neutral {
57+
color: var(--neutralHeadingBackground);
58+
}
59+
.content-inner blockquote :is(h3, h4).tip {
60+
color: var(--tipHeadingBackground);
61+
}
62+
63+
.content-inner blockquote :is(h3, h4):is(.warning, .error, .info, .neutral, .tip) code {
64+
margin: 0 0.5ch;
65+
}
66+
67+
.content-inner blockquote:is(.warning, .error, .info, .neutral, .tip) code {
68+
background-color: var(--admInlineCodeBackground);
69+
border: 1px solid var(--admInlineCodeBorder);
70+
color: var(--admInlineCode);
71+
}
72+
73+
.content-inner blockquote:is(.warning, .error, .info, .neutral, .tip) pre code {
74+
background-color: var(--admCodeBackground);
75+
border: 1px solid var(--admCodeBorder);
76+
}

assets/js/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function fixLinks () {
3030
* Add CSS classes to `blockquote` elements when those are used to
3131
* support admonition text blocks
3232
*/
33-
function fixBlockquotes () {
33+
export function fixBlockquotes () {
3434
const classes = ['warning', 'info', 'error', 'neutral', 'tip']
3535

3636
classes.forEach(element => {

assets/js/entry/epub.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { onDocumentReady } from '../helpers'
2+
import { fixBlockquotes } from '../content'
13
import { initialize as initMakeup } from '../makeup'
24

3-
initMakeup()
5+
onDocumentReady(() => {
6+
initMakeup()
7+
fixBlockquotes()
8+
})

0 commit comments

Comments
 (0)