-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMCL Wide Views.css
396 lines (334 loc) · 17.6 KB
/
MCL Wide Views.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/* === README for MCL Wide Views snippet / Author: Faiz Khuzaimah / twitter: @faizkhuzaimah / github: https://github.com/efemkay
Ver 0.9.6 (updated 2023-09-09) - Code refactor to make use predefined variables and more efficient code base
- refactor all wide views features. require Obsidian installer v1.1.9.
- fixed all issues from previous codebase
Version 0.9.4 (updated 2023-07-05)
- fixed wide-backlinks not working since Obsidian V1
- improved support for Minimal V7
What is this snippet for?
- for any users to use with any theme to complement any missing page/block width control
- available cssClass:
- wide-page
- wide-table
- wide-dataview
- wide-callout
- wide-backlinks
- narrow-page
- style settings toggle
- is-adj-rll with adj-rll-max-width input
Important Notice
- this snippet requires Obsidian installer version (not app version) of 1.1.9 or higher as it requires Electron v21
Credits
- Kevin Powell Youtube channel
*/
/* === Wide Page === */
/* -- Main Code - EV & RV -- */
body .wide-page { --file-line-width: 100%; }
/* -- Special adjustment for Community Themes */
/* Minimal */
body[class*="minimal-tab-title"] .wide-page {
--line-width: 100%;
--max-width: 95%;
--container-table-width: var(--line-width);
--container-table-max-width: var(--max-width);
}
/* AnuPpuccin */
/* body .wide-page { --anp-preview-width-pct: 100%; } */
/* === Adjustable RLL === */
/* cssClass toggle to allow users to adjust the RLL via Style Settings.
Obsidian v1.0.0 makes it easier to do adjustable RLL ;) */
/* -- Main Code - Editing and Reading View -- */
body.is-adj-rll .view-content { --file-line-width: var(--adj-rll-max-width); }
/* === Narrow Page === */
/* cssClass YAML to allow users with disabled RLL to introduce RLL per
page/note basis. width is following obsidian default setting, or you
can change it via MCL's Adjustable RLL */
/* -- Main Code - Editing and Reading View -- */
.narrow-page.markdown-source-view .cm-sizer,
.narrow-page.markdown-preview-view .markdown-preview-sizer {
max-width: var(--file-line-width);
margin-inline: auto;
}
/* === General Setups for Wide Blocks === */
/* -- Setup for @container -- */
:is(.wide-table-global, .wide-dataview-global, .wide-callout-global, .wide-backlinks-global) .markdown-source-view.is-readable-line-width,
:is(.wide-table-global, .wide-dataview-global, .wide-callout-global, .wide-backlinks-global) .markdown-preview-view.is-readable-line-width,
:is(.wide-table, .wide-dataview, .wide-callout, .wide-backlinks).markdown-source-view.is-readable-line-width,
:is(.wide-table, .wide-dataview, .wide-callout, .wide-backlinks).markdown-preview-view.is-readable-line-width {
container-name: content-view;
container-type: inline-size;
}
/* === Wide Blocks - Wide Table === */
/* -- Mai.n Code - EV & RV -- */
body {
--wide-tbl-left-ev-adj: -4rem;
--wide-tbl-min-left-ev: 0.5rem;
--wide-tbl-width-ev: calc( var(--file-line-width) - var(--wide-tbl-left-ev-adj) );
}
body:has(.cm-gutters) {
--wide-tbl-left-ev-adj: 1rem;
--wide-tbl-min-left-ev: 6rem;
}
@container content-view (width > 50px) {
/* editing view */
:is(.wide-table-global, .wide-table) .cm-embed-block.cm-table-widget {
width: calc(100cqi - 4rem);
margin-left: calc( max( 100cqi - var(--wide-tbl-width-ev), var(--wide-tbl-min-left-ev) ) / 2 * -1 ) !important;
}
/* reading view */
:is(.wide-table-global .markdown-preview-view, .wide-table.markdown-preview-view) div:has(> table) {
width: 100cqi;
margin-left: calc( max( 100cqi - var(--file-line-width), 1rem ) / 2 * -1 ) !important;
}
/* centering the table a bit */
:is(.wide-table-global, .wide-table) .cm-embed-block.cm-table-widget table,
:is(.wide-table-global .markdown-preview-view, .wide-table.markdown-preview-view) div > table
{ margin-inline: auto; }
}
/* -- Special adjustment for Community Themes */
/* Minimal, complete re-write for the theme due to many !important used by the theme */
body[class*="minimal-tab-title"] {
--wide-tbl-left-adj: -4rem;
--wide-tbl-width-adj: 2rem;
}
body[class*="minimal-tab-title"]:has(.cm-gutters) {
--wide-tbl-left-adj: -4rem;
--wide-tbl-width-adj: 0rem;
}
body[class*="minimal-tab-title"]:has(.cm-gutters).minimal-theme {
--wide-tbl-left-adj: 0rem;
}
@container content-view (width > 50px) {
body[class*="minimal-tab-title"][class*="wide-table-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-embed-block.cm-table-widget,
body[class*="minimal-tab-title"] .wide-table.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-embed-block.cm-table-widget {
width: calc(100cqi - 4rem) !important;
max-width: 100%;
margin-left: calc( var(--wide-tbl-left-adj) / 2 * -1 ) !important;
}
body[class*="minimal-tab-title"][class*="wide-table-global"] .markdown-preview-view .markdown-preview-sizer div:has(> table),
body[class*="minimal-tab-title"] .wide-table.markdown-preview-view .markdown-preview-sizer div:has(> table) {
width: calc(100cqi - 2rem - var(--wide-tbl-width-adj) ) !important;
max-width: 100%;
margin-left: calc( var(--wide-tbl-left-adj) / 2 * -1 ) !important;
}
/* centering the table a bit */
body[class*="minimal-tab-title"][class*="wide-table-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-embed-block.cm-table-widget table,
body[class*="minimal-tab-title"] .wide-table.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-embed-block.cm-table-widget table,
body[class*="minimal-tab-title"][class*="wide-table-global"] .markdown-preview-view .markdown-preview-sizer div > table,
body[class*="minimal-tab-title"] .wide-table.markdown-preview-view .markdown-preview-sizer div > table
{ margin-inline: auto; }
}
/* Catppuccin */
body[class*="ctp-"].is-adj-rll:not([class*="anp-default"]) { --wide-tbl-left-ev-adj: -8rem; }
/* === Wide Blocks - Wide Dataview === */
/* there are options to enable it (a) per page basis and (b) globally
however, editing view is a hackaround */
/* -- Main Code - EV & RV -- */
body {
--wide-dv-left-ev-adj: -4rem;
--wide-dv-min-left-ev: 0.5rem;
--wide-dv-width-ev: calc( var(--file-line-width) - var(--wide-dv-left-ev-adj) );
}
body:has(.cm-gutters) {
--wide-dv-left-ev-adj: 1.7rem;
--wide-dv-min-left-ev: 6.5rem;
}
@container content-view (width > 50px) {
:is(.wide-dataview-global, .wide-dataview) .cm-preview-code-block:has(> .block-language-dataview),
:is(.wide-dataview-global, .wide-dataview) .cm-preview-code-block:has(> .block-language-dataviewjs) {
width: calc(100cqi - 4rem );
margin-left: calc( max( 100cqi - var(--wide-dv-width-ev), var(--wide-dv-min-left-ev) ) / 2 * -1 ) !important;
}
:is(.wide-dataview-global, .wide-dataview) div:has(> .block-language-dataview),
:is(.wide-dataview-global, .wide-dataview) div:has(> .block-language-dataviewjs) {
width: 100cqi;
margin-left: calc( max( 100cqi - var(--file-line-width), 1rem ) / 2 * -1 ) !important;
}
}
/* -- Special adjustment for Community Themes */
/* Minimal, complete re-write for the theme */
body[class*="minimal-tab-title"] {
--wide-dv-width-adj: 2rem;
}
body[class*="minimal-tab-title"]:has(.cm-gutters) {
--wide-dv-left-ev-adj: -4rem;
--wide-dv-width-adj: 0rem;
}
body[class*="minimal-tab-title"]:has(.cm-gutters).minimal-theme {
--wide-dv-left-ev-adj: 0rem;
}
@container content-view (width > 50px) {
body[class*="minimal-tab-title"][class*="wide-dataview-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-preview-code-block:has(> .block-language-dataview),
body[class*="minimal-tab-title"] .wide-dataview.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-preview-code-block:has(> .block-language-dataview),
body[class*="minimal-tab-title"][class*="wide-dataview-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-preview-code-block:has(> .block-language-dataviewjs),
body[class*="minimal-tab-title"] .wide-dataview.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-preview-code-block:has(> .block-language-dataviewjs) {
width: calc(100cqi - 4rem);
max-width: 100%;
margin-left: calc( var(--wide-dv-left-ev-adj) / 2 * -1 ) !important;
}
body[class*="minimal-tab-title"][class*="wide-dataview-global"] .markdown-preview-view div:has(> .block-language-dataview),
body[class*="minimal-tab-title"] .wide-dataview.markdown-preview-view div:has(> .block-language-dataview),
body[class*="minimal-tab-title"][class*="wide-dataview-global"] .markdown-preview-view div:has(> .block-language-dataviewjs),
body[class*="minimal-tab-title"] .wide-dataview.markdown-preview-view div:has(> .block-language-dataviewjs) {
width: calc(100cqi - 2rem - var(--wide-dv-width-adj) );
max-width: 100%;
margin-left: calc( var(--wide-dv-left-ev-adj) / 2 * -1 ) !important;
}
/* centering the table a bit */
body[class*="minimal-tab-title"][class*="wide-dataview-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content table,
body[class*="minimal-tab-title"] .wide-dataview.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content table,
body[class*="minimal-tab-title"] .wide-dataview.markdown-preview-view .markdown-preview-sizer div > table {
width: calc( 100% );
}
}
/* Catppuccin */
body[class*="ctp-"].is-adj-rll:not([class*="anp-default"]) { --wide-dv-left-ev-adj: -8rem; }
/* === Wide Blocks - Wide Callout === */
/* there are options to enable it (a) per page basis and (b) globally
however, editing view is a hackaround
!important needed because app's default uses it `.markdown-source-view.mod-cm6 .cm-content > *` */
/* -- Main Code - EV & RV -- */
body {
--wide-co-left-ev-adj: -3.8rem;
--wide-co-min-left-ev: 0.5rem;
--wide-co-width-ev-adj: 4rem;
--wide-co-width-ev: calc(var(--file-line-width) - var(--wide-co-left-ev-adj) );
}
body:has(.cm-gutters) {
--wide-co-left-ev-adj: 1.7rem;
--wide-co-min-left-ev: 6.5rem;
}
@container content-view (width > 50px) {
:is(.wide-callout-global, .wide-callout) .cm-embed-block.cm-callout {
width: calc( 100cqi - var(--wide-co-width-ev-adj) );
margin-left: calc( max( 100cqi - var(--wide-co-width-ev), var(--wide-co-min-left-ev) ) / 2 * -1 ) !important;
}
:is(.wide-callout-global, .wide-callout) .markdown-preview-sizer > div:has(> .callout) {
width: 100cqi;
margin-left: calc( max( 100cqi - var(--file-line-width), 1rem ) / 2 * -1 ) !important;
}
}
/* -- Special adjustment for Community Themes */
/* Minimal, complete re-write for the theme */
body[class*="minimal-tab-title"] { --folding-toggle: 1; }
body.minimal-theme { --folding-toggle: 0; }
body.minimal-theme:not(:has(.cm-gutters)) { --folding-toggle: 1; }
@container content-view (width > 50px) {
body[class*="minimal-tab-title"][class*="wide-callout-global"] .markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-embed-block.cm-callout,
body[class*="minimal-tab-title"] .wide-callout.markdown-source-view .cm-contentContainer.cm-contentContainer .cm-content .cm-embed-block.cm-callout {
width: calc(100cqi - 4rem);
max-width: 100%;
margin-left: calc( var(--folding-offset) * var(--folding-toggle) ) !important;
}
body[class*="minimal-tab-title"][class*="wide-callout-global"] .markdown-preview-view .markdown-preview-sizer > div:has(> .callout),
body[class*="minimal-tab-title"] .wide-callout.markdown-preview-view .markdown-preview-sizer > div:has(> .callout) {
width: calc(100cqi - 2rem - 2rem * var(--folding-toggle) );
max-width: calc(100% - 0rem);
margin-left: calc( var(--folding-offset) * var(--folding-toggle) ) !important;
}
}
/* AnuPpuccin */
body[class*="anp-"] { --wide-co-width-ev-adj: 3.5rem; }
/* Catppuccin */
body[class*="ctp-"].is-adj-rll:not([class*="anp-default"]) { --wide-co-left-ev-adj: -7.8rem; }
/* === Wide Blocks - Wide Backlinks === */
/* -- Main Code - EV & RV -- */
body {
--wide-bl-left-ev-adj: 4rem;
--wide-bl-width-ev: calc(var(--file-line-width) + var(--wide-bl-left-ev-adj) );
}
@container content-view (width > 50px) {
:is(.wide-backlinks-global .markdown-source-view, .wide-backlinks.markdown-source-view) .embedded-backlinks {
width: calc(100cqi - 3.5rem);
margin-left: calc( max( 100cqi - var(--wide-bl-width-ev), 1rem ) / 2 * -1 );
}
:is(.wide-backlinks-global .markdown-preview-view, .wide-backlinks.markdown-preview-view) .embedded-backlinks {
width: calc(100cqi - 0rem);
margin-left: calc( max( 100cqi - var(--file-line-width), 1rem ) / 2 * -1 );
}
}
/* -- Special adjustment for Community Themes */
/* Minimal, complete re-write for the theme */
body[class*="minimal-tab-title"] {
--wide-bl-width-adj: 4rem;
}
body[class*="minimal-tab-title"]:has(.cm-gutters) {
--wide-bl-width-adj: 0rem;
}
@container content-view (width > 50px) {
body[class*="minimal-tab-title"][class*="wide-backlinks-global"] .markdown-source-view .cm-sizer .embedded-backlinks,
body[class*="minimal-tab-title"] .wide-backlinks.markdown-source-view .cm-sizer .embedded-backlinks {
width: calc(100cqi - 4.5rem);
max-width: unset;
margin-left: calc( var(--wide-bl-width-adj) / 2 * 1 ) !important;
}
body[class*="minimal-tab-title"][class*="wide-backlinks-global"] .markdown-preview-view .embedded-backlinks,
body[class*="minimal-tab-title"] .wide-backlinks.markdown-preview-view .embedded-backlinks {
width: calc( 100cqi - 2rem - var(--wide-bl-width-adj)/2 );
margin-left: calc( max( 100cqi - var(--line-width) - var(--wide-bl-width-adj) , 4rem ) / 2 * -1 ) !important;
}
}
/* Catppuccin */
body[class*="ctp-"].is-adj-rll:not([class*="anp-default"]) { --wide-bl-left-ev-adj: 13.5rem; }
/* @settings
name: Modular CSS Layout - Wide Views
id: modular-css-layout-wv
settings:
-
id: adj-rll-title
title: Adjustable RLL Settings
description: Control max-width for all page/note by default. RLL must be **enabled**
type: heading
level: 2
collapsed: true
-
id: is-adj-rll
title: Enable Adjustable RLL
description: Add is-adj-rll class to the body element
type: class-toggle
-
id: adj-rll-max-width
title: Max Width for Normal Width page
description: Can use any unit e.g. px, em, ch
type: variable-text
default: 700px
-
id: wide-view-title
title: Vault-wide toggle for Wide Blocks
description: For wide -table/-dataview/-callout/-backlinks. RLL must be **enabled**
type: heading
level: 2
collapsed: true
-
id: wide-dataview-global
title: Enable `wide-dataview` vault-wide
description: use `wide-dataview` in yaml to enable only for selected note/page
type: class-toggle
-
id: wide-table-global
title: Enable `wide-table` vault-wide
description: use `wide-table` in yaml to enable only for selected note/page
type: class-toggle
-
id: wide-callout-global
title: Enable `wide-callout` vault-wide
description: use `wide-callout` in yaml to enable only for selected note/page
type: class-toggle
-
id: wide-backlinks-global
title: Enable `wide-backlinks` vault-wide
description: use `wide-backlinks` in yaml to enable only for selected note/page
type: class-toggle
-
id: narrow-view-title
title: Narrow Page Settings
description: Control max-width page/note with cssClass `narrow-page`. RLL must be **disabled**
type: heading
level: 2
collapsed: true
-
id: narrow-max-width
title: Max Width for Narrow View page (any unit e.g. px, em, ch)
type: variable-text
default: 750px
*/