-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSidenote Auto-Adjust Module showcase-template.css
113 lines (104 loc) · 5.29 KB
/
Sidenote Auto-Adjust Module showcase-template.css
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* Sidenote Auto-Adjust Module showcase-template.css */
/* author: cerenkov */
/* Say, if you're going to create a my-custom-style-sidenote-using-SAAM.css snippet
you choose the way how sidenotes are designed to generate:
* by using a custom class: <span class=my-custom-sidenote> sidenote content </span>, or
* by using a custom callout-type: > [!my-custom-sidenote|my-metadata-modifier]
you should prepare three variants: my-custom-sidenote-r for right, my-custom-sidenote-l for left and my-custom-sidenote for default
(custom names in lowercases recommended, since the obsidian callout plugin generates HTML elements with lowercase attributes)
then you design your custom styling: fonts, colors, backgrounds... for your .my-custom-sidenote class elements or your .callout class elements
then you copy-paste the positioning part and replace with your own class selectors */
/* showcase-template: styling part */
/* Say, if you choose to use the >[!my-custom-sidenote] callout implementation */
/* here's the common styling for all three variants [data-callout|="my-custom-sidenote"] */
.callout[data-callout|="my-custom-sidenote"] {
.callout-title {
display: none;
}
--p-spacing: 0;
margin-block: 0;
color: blue;
}
.cm-callout:has(.callout[data-callout|="my-custom-sidenote"]) > .edit-block-button {
display: none;
}
/* need higher specificity to override obsidian app's !important property */
.markdown-source-view.mod-cm6 .cm-content > .cm-callout[contenteditable=false]:has(.callout[data-callout|="my-custom-sidenote"]) {
overflow: visible;
contain: none !important;
}
/* extra shift in Live Preview mode due to callouts syntax requiring an extra empty line */
.markdown-source-view .callout[data-callout|="my-custom-sidenote"] {
margin-top: 2.1em !important;
}
/* showcase-template: positioning part */
/* you don't need to change the CSS properties below */
/* just copy-paste and replace the .callout[data-callout="my-custom-sidenote"] 's with your own class selectors */
/* the variables --sidenote-default-position --sidenote-width --sidenote-edgeout --sidenote-margins-*-* are provided by the Sidenote Auto-Adjust Module */
.markdown-preview-view, .markdown-source-view {
.callout[data-callout="my-custom-sidenote-r"] {
position: relative;
float: right;
clear: right;
@container not style(--sidenote-edgeout) {
width: var(--sidenote-width);
margin-inline: var(--sidenote-margins-r-non-intrusive);
}
@container style(--sidenote-edgeout) {
max-width: var(--sidenote-width);
margin-inline: var(--sidenote-margins-r-intrusive);
}
}
.callout[data-callout="my-custom-sidenote-l"] {
position: relative;
float: left;
clear: left;
@container not style(--sidenote-edgeout) {
width: var(--sidenote-width);
margin-inline: var(--sidenote-margins-l-non-intrusive);
}
@container style(--sidenote-edgeout) {
max-width: var(--sidenote-width);
margin-inline: var(--sidenote-margins-l-intrusive);
}
}
.callout[data-callout="my-custom-sidenote"] {
position: relative;
float: var(--sidenote-default-position);
clear: var(--sidenote-default-position);
@container not style(--sidenote-edgeout) {
width: var(--sidenote-width);
@container style(--sidenote-default-position: right) {
margin-inline: var(--sidenote-margins-r-non-intrusive);
}
@container style(--sidenote-default-position: left) {
margin-inline: var(--sidenote-margins-l-non-intrusive);
}
}
@container style(--sidenote-edgeout) {
max-width: var(--sidenote-width);
@container style(--sidenote-default-position: right) {
margin-inline: var(--sidenote-margins-r-intrusive);
}
@container style(--sidenote-default-position: left) {
margin-inline: var(--sidenote-margins-l-intrusive);
}
}
}
}
/* showcase-template: fallback values part (when not working with the Sidenote Auto-Adjust Module) */
/* these lines can be deleted if it's assured to be working with the Sidenote Auto-Adjust Module */
/* the showcase-template also works on its own without the Sidenote Auto-Adjust Module, with variables taking fallback values */
/* if at the same time, the SAAM.css snippet is also enabled, then the module overrides these variables, and you'll get auto-adjusting sidenotes */
/* otherwise when SAAM.css is toggled off, you'll get fixed-width my-custom-sidenotes */
:root {
--sidenote-default-position: right;
--sidenote-width: 15rem;
--sidenote-margin: 1rem;
--sidenote-edgeout: unset;
--sidenote-margins-r-non-intrusive: var(--sidenote-margin) calc(-1 * var(--sidenote-width) - var(--sidenote-margin));
--sidenote-margins-r-intrusive: var(--sidenote-margin) var(--sidenote-edgeout);
--sidenote-margins-l-non-intrusive: calc(-1 * var(--sidenote-width) - var(--sidenote-margin)) var(--sidenote-margin);
--sidenote-margins-l-intrusive: var(--sidenote-edgeout) calc(var(--sidenote-margin) + 1rem);
/* when sidenote position is left, margin-right has to be larger to avoid overlap with main text bullet points */
}