-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
advanced_background.js
78 lines (67 loc) · 2.27 KB
/
advanced_background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/** @module */
import postcssPlugin from '../helpers/postcss_plugin'
/**
* Marpit PostCSS advanced background plugin.
*
* Append style to suport the advanced background.
*
* @function advancedBackground
*/
export const advancedBackground = postcssPlugin(
'marpit-postcss-advanced-background',
() => (css) => {
css.last.after(
`
section[data-marpit-advanced-background="background"] {
columns: initial !important;
display: block !important;
padding: 0 !important;
}
section[data-marpit-advanced-background="background"]::before,
section[data-marpit-advanced-background="background"]::after,
section[data-marpit-advanced-background="content"]::before,
section[data-marpit-advanced-background="content"]::after {
display: none !important;
}
section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container] {
all: initial;
display: flex;
flex-direction: row;
height: 100%;
overflow: hidden;
width: 100%;
}
section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction="vertical"] {
flex-direction: column;
}
section[data-marpit-advanced-background="background"][data-marpit-advanced-background-split] > div[data-marpit-advanced-background-container] {
width: var(--marpit-advanced-background-split, 50%);
}
section[data-marpit-advanced-background="background"][data-marpit-advanced-background-split="right"] > div[data-marpit-advanced-background-container] {
margin-left: calc(100% - var(--marpit-advanced-background-split, 50%));
}
section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container] > figure {
all: initial;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
flex: auto;
margin: 0;
}
section[data-marpit-advanced-background="content"],
section[data-marpit-advanced-background="pseudo"] {
background: transparent !important;
}
section[data-marpit-advanced-background="pseudo"],
:marpit-container > svg[data-marpit-svg] > foreignObject[data-marpit-advanced-background="pseudo"] {
pointer-events: none !important;
}
section[data-marpit-advanced-background-split] {
width: 100%;
height: 100%;
}
`.trim()
)
}
)
export default advancedBackground