Advertisement
dhniceday

Untitled

Dec 11th, 2022
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 13.91 KB | None | 0 0
  1. /*
  2.     - available cssClass:
  3.         - wide-page
  4.         - wide-dataview (require CT plugin)
  5.         - wide-table (require CT plugin)
  6.         - wide-callout
  7.         - wide-backlinks
  8.         - narrow-page
  9.         - cssClass toggle: is-adj-rll and adj-rll-max-width
  10. */
  11. body{
  12.     --normal-max-width: var(--file-line-width);
  13.     --narrow-max-width: var(--file-line-width);
  14.     --adj-rll-max-width: 750px;
  15. }
  16.  
  17. /* === Wide Page === */
  18.  
  19.  
  20.  
  21.     /* --- Editing View ---
  22.         - set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it.
  23.         - "width:100%" added for Blue Topaz
  24.         - .cm-content added to override Mado 11
  25.         - focus to fix for v0.16.x -- .markdown-source-view.mod-cm6 .cm-sizer
  26.     */
  27.  
  28.  
  29.     /* - WPEV - */
  30.     /* Main code */
  31.     /* Set the containers (all relevant levels) to max-width 100%. Applicable to global and per note (cssClass) */
  32.     /* selector for editing container .cm-sizer */
  33.     :is(body[class*="wide-"], div[class*="wide-"].markdown-source-view.mod-cm6.is-readable-line-width) .cm-sizer,
  34.  
  35.     :is(body[class*="wide-"]:not(.max-view-enabled), div[class*="wide-"].markdown-source-view.mod-cm6) :is(.cm-contentContainer.cm-contentContainer, .cm-contentContainer.cm-contentContainer > .cm-content, .cm-contentContainer.cm-contentContainer > .cm-content > div, .embedded-backlinks, .embedded-backlinks > div)
  36.         { max-width: 100%; width: 98%;  }
  37.  
  38.     /* Special adjustment - for Minimal
  39.         - 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
  40.         - but for callout, require width: auto */
  41.     div[class*="wide-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table { max-width: 100% }
  42.     div[class*="wide-"].markdown-source-view.mod-cm6.is-readable-line-width .cm-embed-block.cm-callout>.callout { max-width: 100%; width: auto; }
  43.         /* overriding margin-left setting to obsidian "default" */
  44.     div[class*="wide-"].markdown-source-view.mod-cm6.is-readable-line-width .cm-embed-block.cm-callout>.callout,
  45.     div[class*="wide-page"].markdown-source-view.mod-cm6 .cm-contentContainer > .embedded-backlinks,
  46.     div[class*="wide-page"].markdown-source-view.mod-cm6 .cm-contentContainer > .cm-content > div
  47.         {margin-left: 20px !important; }
  48.     div[class*="wide-page"].markdown-source-view.mod-cm6.is-readable-line-width table
  49.         {margin-left:   !important; }
  50.  
  51.     /* Additional Note
  52.         - Yin Yang uses .markdown-source-view.mod-cm6 { width: !important;}. I'm skipping fixes for this until there's user request
  53.         - added :is(body:not(.max-view-enabled) .mod-root) to accomodate for Shimmering Focus, does not affect other themes */
  54.  
  55.  
  56.     /* --- Reading View --- */
  57.     /* -- similar to Editing View (WPEV), set the RLL to 100% for any css class with "wide" word in it
  58.         - :is() used for OR between global toggle and "cssClass" in yaml
  59.         - "width:100%" added for Blue Topaz */
  60.  
  61.     /* - WPRV - */
  62.     /* Main code */
  63.     /* Set the containers (all relevant levels) to max-width 100%. Applicable to global and per note (cssClass) */
  64.     body[class*="wide-"] :is(.markdown-preview-sizer.markdown-preview-sizer, .markdown-preview-sizer.markdown-preview-sizer > div),
  65.     div[class*="wide-"].markdown-preview-view :is(.markdown-preview-sizer.markdown-preview-sizer, .markdown-preview-sizer.markdown-preview-sizer > div)
  66.         { max-width: 100%; margin-inline: auto; width: 100%;}
  67.  
  68.     /* Special adjustment - for Minimal theme */
  69.     div[class*="wide-"].markdown-preview-view {padding-inline: 0px;}
  70.  
  71.     /* special line just for Atom theme -- commented out for now */
  72.     /*
  73.     div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer,
  74.     div[class*="wide-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
  75.         { max-width: 100% !important; } */
  76.  
  77.  
  78. /* === Wide Blocks (i.e. Dataview, Table, Callout & Backlink) === */
  79.  
  80.  
  81.     /* --- Editing View ---
  82.        - For Editing View, the approach is slightly different. After "wide-page" set all max-width to 100%, I adjust the .cm-content > * blocks to normal width and then selectively target blocks for wide width
  83.        - must note to ensure specificity rule over some theme), then
  84.        - global settings selector need to be separated to ensure it is not conditional to cssClass yaml
  85.        - `body[class*="wide-"]` used for global settings, `div[class*="wide-"].markdown-preview-view` used for per note cssClass
  86.     */
  87.  
  88.     /* - WBEV - */
  89.     /* Main code */
  90.     /* Generally set all blocks to normal width, no need (yet) for global settings as I didn't adjust it Wide Page above */
  91.     /* set .cm-sizer > .inline-title to normal width. has to be separated because i don't want margin auto */
  92.     :is(body[class*="wide-"]:not(.max-view-enabled) .mod-root .markdown-source-view.mod-cm6:not(.wide-page), div.markdown-source-view.mod-cm6:is(.wide-dataview,.wide-table,.wide-backlinks,.wide-callout)) .cm-sizer > .inline-title
  93.         { max-width: var(--normal-max-width); width: 100%; margin-inline: auto;  }
  94.     /* set normal width to `.cm-content > div` and `.embedded-links` only (override the WPEV) */
  95.     :is(body[class*="wide-"]:not(.max-view-enabled) .markdown-source-view.mod-cm6:not(.wide-page), div[class*="wide-"].markdown-source-view.mod-cm6:not(.wide-page)) :is(.cm-contentContainer.cm-contentContainer > .cm-content > div, .cm-sizer > .embedded-backlinks)
  96.         { max-width: var(--normal-max-width); margin-inline: auto !important; } /* important for margin needed because app.css:1473 use it for .cm-contentContainer > .cm-content > * */
  97.  
  98.     /* selectors to set dataview, table, callout and/or backlinks to wide */
  99.     :is(body.wide-dataview-global:not(.max-view-enabled) .mod-root .markdown-source-view.mod-cm6, div[class*="-dataview"].markdown-source-view.mod-cm6) .cm-contentContainer.cm-contentContainer > div > div:is(.cm-preview-code-block),
  100.     :is(body.wide-table-global:not(.max-view-enabled) .mod-root .markdown-source-view.mod-cm6, div[class*="-table"].markdown-source-view.mod-cm6) .cm-contentContainer.cm-contentContainer > div > div:is(.HyperMD-table-row, .cm-table-widget),
  101.     :is(body.wide-callout-global:not(.max-view-enabled) .mod-root .markdown-source-view.mod-cm6, div[class*="-callout"].markdown-source-view.mod-cm6) .cm-contentContainer.cm-contentContainer > div > div:is(.cm-callout),
  102.     /* selectors to set backlinks to wide -- not fix yet for 0.16.x */
  103.     :is(body.wide-backlinks-global:not(.max-view-enabled) .mod-root .markdown-source-view.mod-cm6, div[class*="-backlinks"].markdown-source-view.mod-cm6) .cm-sizer > div:is(.embedded-backlinks)
  104.         { max-width: 100%;  }
  105.  
  106.  
  107.     /* Special adjustment - for Minimal */
  108.     :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
  109.         { width: unset; }
  110.     /* Special adjustment - for Minimal - to override custom margin-left that uses !important */
  111.     .wide-table.markdown-source-view.mod-cm6.is-readable-line-width table {margin-left: auto !important; }
  112.  
  113.     /* Additional Notes
  114.         - 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)
  115.         - added :is(body:not(.max-view-enabled) .mod-root) to accomodate for Shimmering Focus, does not affect other themes */
  116.  
  117.  
  118.     /* --- Reading View ---
  119.         - Similar to WBEV, the approach is to leverage on WPRV setting all blocks to wide, set `.markdown-preview-sizer > div` to normal and set related block to wide again
  120.         - For Reading View, wide-dataview and wide-table will require Contextual Typography plugin
  121.         - :is() used to couple global toggle with yaml cssClass
  122.         - wide backlinks still cannot be implemented in 0.16.x as the it is located one div deeper than `.markdown-preview-sizer > div` which means I need to do "look-back", achievable only with :has()
  123.     */
  124.  
  125.     /* - WBRV - */
  126.     /* Main code */
  127.     /* set the containers to normal width */
  128.     :is(body[class*="wide-"] .markdown-preview-view:not(.wide-page), div[class*="wide-"].markdown-preview-view:not(.wide-page)) .markdown-preview-sizer.markdown-preview-sizer > div
  129.         { max-width: var(--normal-max-width); margin-inline: auto;  } /* important is for Atom theme */
  130.     /* set the related blocks to wide width */
  131.     :is(body.wide-dataview-global, div[class*="-dataview"].markdown-preview-view) .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-lang-dataview),
  132.     :is(body.wide-table-global, div[class*="-table"].markdown-preview-view) .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-table),
  133.     :is(body.wide-callout-global, div[class*="-callout"].markdown-preview-view) .markdown-preview-sizer.markdown-preview-sizer > div[data-callout],
  134.     /* comment out wide backlinks as no possible fix (yet) for 0.16.x due to notes above *//*
  135.     :is(body.wide-backlinks-global, div[class*="-backlinks"].markdown-preview-view) .markdown-preview-sizer.markdown-preview-sizer > div:is(.embedded-backlinks)
  136.         { max-width: 100%; }
  137.     */
  138.  
  139.     /* Special adjustment - for Minimal - it also somehow set the table width within dataview block */
  140.     :is(body.wide-dataview-global, div[class*="-dataview"].markdown-preview-view) .markdown-preview-sizer.markdown-preview-sizer > div:is(.el-lang-dataview) table
  141.         { max-width: 100%;  }
  142.     /* Special adjustment - for Minimal - to override Minimal custom width */
  143.     body[class*="global"].contextual-typography .markdown-preview-view.is-readable-line-width .markdown-preview-sizer > div { width: 100%; }
  144.  
  145.     /* Additional Notes
  146.         - .markdown-preview-section is same div as .markdown-preview-sizer
  147.         - Atom uses !important for .markdown-preview-view.is-readable-line-width .markdown-preview-section {...}
  148.             - cannot adjust this at the moment without disrupting other theme's layout */
  149.  
  150.  
  151.     /* Editing and Reading View -- Special Adjustment
  152.         - for table for all theme, since its table not auto margin */
  153.     :is(body.wide-table-global, div[class*="wide-table"]) table { margin-inline: auto;  }
  154.    
  155.  
  156.  
  157.  
  158. /* === Narrow Page === */
  159. /* cssClass YAML to allow users with disabled RLL to introduce RLL per page/note basis */
  160.  
  161.  
  162.     /* --- Editing View ---
  163.         - Set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it
  164.     */
  165.  
  166.     /* - NPEV - */
  167.     /* Main code */
  168.     /* set the containers to narrow width. `div.cm-content` added to override Mado 11 */
  169.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer,
  170.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content,
  171.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content > div,
  172.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks,
  173.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
  174.         { max-width: var(--narrow-max-width); margin-inline: auto; }
  175.  
  176.     /* Special adjustment - for Minimal */
  177.     /* 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 */
  178.     div[class*="narrow-"].markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table
  179.         { max-width: var(--narrow-max-width); }
  180.     /* 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 */
  181.     div[class*="narrow-"].markdown-source-view.mod-cm6:not(.is-readable-line-width) .cm-contentContainer
  182.         { margin-inline: auto !important; }
  183.  
  184.  
  185.     /* --- Reading View ---
  186.         - Similar to Editing View, set the RLL to 100% for any css class with "wide" word in it.
  187.     */
  188.  
  189.     /* - NPRV - */
  190.     /* Main code */
  191.     /* set the note with cssClass: narrow- to max-width of the narrow width */
  192.     div[class*="narrow-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer, /* double-up for specificity */
  193.     div[class*="narrow-"].markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
  194.         { max-width: var(--narrow-max-width); margin-inline: auto;}
  195.  
  196.     /* Special adjustment - for Minimal theme */
  197.     div[class*="narrow-"].markdown-preview-view {padding-inline: 30px;}
  198.  
  199.  
  200. /* === Adjustable RLL === */
  201. /* cssClass toggle to allow users to adjust the RLL via Style Settings */
  202. /* Obsidian v1.0.0 makes it easier to do adjustable RLL -- just single line css ;) */
  203.  
  204.     /* --- Editing and Reading View --- */
  205.     /* - AREV and ARRV - */
  206.     body.is-adj-rll { --file-line-width: var(--adj-rll-max-width); }
  207.  
  208.     /* I still save below snippet for future references. May delete later */
  209.  
  210.         /* --- Editing View ---
  211.             - Set Readable Line Length (RLL) to wide (100%) for any css class with "wide" word in it.
  212.         */
  213.  
  214.         /* - AREV - */
  215.         /* Main code */
  216.         /* set the containers to the custom adj rll width. `div.cm-content` added to override Mado 11 *//*
  217.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer,
  218.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content,
  219.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content table, /* for minimal *//*
  220.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .cm-content > div,
  221.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks,
  222.         .is-adj-rll .markdown-source-view.mod-cm6 .cm-contentContainer.cm-contentContainer > .embedded-backlinks > div
  223.             { max-width: var(--adj-rll-max-width); margin-inline: auto; }
  224.  
  225.         /* --- Reading View ---
  226.             - Similar to Editing View, set the RLL to 100% for any css class with "wide" word in it
  227.         */
  228.  
  229.         /* - ARRV - */
  230.         /* Main code */
  231.         /* set the containers to the custom adj rll width *//*
  232.         .is-adj-rll .markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer, /* double-up for specificity *//*
  233.         .is-adj-rll .markdown-preview-view .markdown-preview-sizer.markdown-preview-sizer > div
  234.             { max-width: var(--adj-rll-max-width); margin-inline: auto;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement