forked from efemkay/obsidian-modular-css-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCL Wide Views.css
217 lines (180 loc) · 12.2 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
/* === README ===
Author: Faiz Khuzaimah / twitter: @faizkhuzaimah / github: https://github.com/efemkay
Updated: 2022-05-29 (version: 0.2.0)
- fixes for GH issues #9 and #11
- adj for Compatibility with Minimal 5.2.9
- add features adjustable RLL and narrow page class
- add style settings for adj RLL width and toggle whole class
What is this snippet for?
- for any users to use with any theme to complement any missing page/block width control
- some features will require mgmeyer's Contextual Typography (CT) plugin
- available cssClass:
- wide-page
- wide-dataview (require CT plugin)
- wide-table (require CT plugin)
- wide-callout
- wide-backlinks
- narrow-page
- cssClass toggle: is-adj-rll and adj-rll-max-width
Credits
- Kevin Powell Youtube channel
- hydescarf for accomodating my snippets adjustment
*/
/* @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 (any unit e.g. px, em, ch)
type: variable-text
default: 750px
-
id: wide-view-title
title: Wide Page Settings
description: Control max-width block for page with cssClass `wide-page`. RLL can be enabled or disabled
type: heading
level: 2
collapsed: true
-
id: normal-max-width
title: Max Width for Normal Width block (any unit e.g. px, em, ch)
type: variable-text
default: 750px
-
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
*/
body{
--normal-max-width: 750px;
--narrow-max-width: 750px;
--adj-rll-max-width: 750px;
}
/* === Wide Page === */
/* Editing View -- set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it.
- "width:100%" added for Blue Topaz
- .cm-content added to override Mado 11 */
:is(body:not(.max-view-enabled) .mod-root) div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer,
:is(body:not(.max-view-enabled) .mod-root) div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content,
:is(body:not(.max-view-enabled) .mod-root) div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content > div,
div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks,
div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
{ max-width: 100%; width: 98%;}
/* Editing View -- Special adjustment
- for Minimal theme where it has table also set with max-width. but table require separate line because we don't want width: 100% as that would stretch the table */
div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table
{ max-width: 100% }
div[class*="wide-page"].markdown-source-view.mod-cm6 .cm-contentContainer > .embedded-backlinks,
div[class*="wide-page"].markdown-source-view.mod-cm6 .cm-contentContainer > .cm-content > div
{margin-left: 20px !important; }
/* Editing View -- Additional Note
- Yin Yang uses .markdown-source-view.mod-cm6 { width: !important;}. I'm skipping fixes for this until there's user request
- added :is(body:not(.max-view-enabled) .mod-root) to accomodate for Shimmering Focus, does not affect other themes */
/* Reading View -- similar to Editing View, set the RLL to 100% for any css class with "wide" word in it
- "width:100%" added for Blue Topaz */
div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer, /* double-up for specificity */
div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
{ max-width: 100%; margin-inline: auto; width: 100%;} /* important is for Atom theme */
/* Reading View -- Special Adjustment
- for Minimal theme */
div[class*="wide-"].markdown-preview-view {padding-inline: 30px;}
/* special line just for Atom theme -- commented out for now */
/*
div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer,
div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
{ max-width: 100% !important; } */
/* === Wide Dataview, Table & Backlink === */
/* Editing View -- set all divs back to normal width (ensuring specificity rule over some theme), then
expand to full-width for each selected css class (i.e. wide-dataview, wide-table and wide-backlinks) */
:is(body:not(.max-view-enabled) .mod-root) div.markdown-source-view.mod-cm6:is(.wide-dataview,.wide-table,.wide-backlinks,.wide-callout) .cm-contentContainer.cm-contentContainer > .cm-content > div,
:is(body:not(.max-view-enabled) .mod-root) div.markdown-source-view.mod-cm6:is(.wide-dataview,.wide-table,.wide-backlinks,.wide-callout) .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
{max-width: var(--normal-max-width); margin-inline: auto !important;} /* important for margin needed because app.css:2842 use it */
:is(body:not(.max-view-enabled) .mod-root) div[class*="-dataview"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > div > div:is(.cm-preview-code-block),
:is(body:not(.max-view-enabled) .mod-root) div[class*="-table"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > div > div:is(.HyperMD-table-row, .cm-table-widget),
:is(body:not(.max-view-enabled) .mod-root) div[class*="-callout"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > div > div:is(.cm-callout),
:is(body:not(.max-view-enabled) .mod-root) div[class*="-backlinks"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > div:is(.embedded-backlinks) > div
{ max-width: 100%; }
:is(body:not(.max-view-enabled) .mod-root) div[class*="-dataview"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > div > div:is(.cm-preview-code-block) > div /* for minimal */
{ width: unset;}
/* Editing View -- Additional Notes
- Minimal removes inline padding for .markdown-source-view.mod-cm6 .cm-scroller so it is flushed to the very edges (no way to adjust currently)
- added :is(body:not(.max-view-enabled) .mod-root) to accomodate for Shimmering Focus, does not affect other themes */
/* Reading View -- similar to Editing View, set all divs to normal-width and then selected divs to full-width,
however, for Reading View, wide-dataview and wide-table will require Contextual Typography plugin */
div.markdown-preview-view:is(.wide-dataview,.wide-table,.wide-backlinks,.wide-callout) .markdown-preview-sizer.markdown-preview-sizer > div
{ max-width: var(--normal-max-width); margin-inline: auto; } /* important is for Atom theme */
div[class*="-dataview"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-lang-dataview),
div[class*="-dataview"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-lang-dataview) table, /* for minimal */
div[class*="-table"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-table),
div[class*="-callout"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div[data-callout],
div[class*="-backlinks"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div:is(.embedded-backlinks)
{ max-width: 100%; }
/* Reading View -- Additional Notes
- .markdown-preview-section is same div as .markdown-preview-sizer
- Atom uses !important for .markdown-preview-view.is-readable-line-width .markdown-preview-section {...}
- cannot adjust this at the moment without disrupting other theme's layout */
/* Editing and Reading View -- Special Adjustment
- for table for all theme, since its table not auto margin */
div[class*="wide-table"] table { margin-inline: auto; }
/* === Narrow Page === */
/* cssClass YAML to allow users with disabled RLL to introduce RLL per page/note basis */
/* Editing View -- set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it
- "width:100%" added for Blue Topaz / div.cm-content added to override Mado 11 */
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer,
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content,
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content > div,
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks,
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
{ max-width: var(--narrow-max-width); margin-inline: auto; }
/* Editing View -- Special Adjustment */
/* - for Minimal theme where it has table also set with max-width. but table require separate line because we don't want margin: auto that would center the table relative to other elements like para */
div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table, /* for minimal */
{ max-width: var(--narrow-max-width); }
/* - for Minimal theme but affecting all theme. Minimal apparently uses !important to control margin the adjustment is still safe because for narrow-page you would want margin: auto anyway */
div[class*="narrow-"].markdown-source-view.mod-cm6:not(.is-readable-line-width) .cm-contentContainer
{ margin-inline: auto !important; }
/* Reading View -- similar to Editing View, set the RLL to 100% for any css class with "wide" word in it.
- "width:100%" added for Blue Topaz */
div[class*="narrow-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer, /* double-up for specificity */
div[class*="narrow-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
{ max-width: var(--narrow-max-width); margin-inline: auto;}
/* Reading View -- Special Adjustment
- for Minimal theme */
div[class*="narrow-"].markdown-preview-view {padding-inline: 30px;}
/* === Adjustable RLL === */
/* cssClass toggle to allow users to adjust the RLL via Style Settings */
/* Editing View -- set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it.
- "width:100%" added for Blue Topaz / div.cm-content added to override Mado 11 */
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer,
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content,
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table, /* for minimal */
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content > div,
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks,
.is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
{ max-width: var(--adj-rll-max-width); margin-inline: auto; }
/* Reading View -- similar to Editing View, set the RLL to 100% for any css class with "wide" word in it
- "width:100%" added for Blue Topaz */
.is-adj-rll .markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer, /* double-up for specificity */
.is-adj-rll .markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
{ max-width: var(--adj-rll-max-width); margin-inline: auto;}