Skip to content

Instantly share code, notes, and snippets.

@bborysenko
Created September 23, 2020 15:19
Show Gist options
  • Save bborysenko/eb66fbf7c95670f184e55f790570a804 to your computer and use it in GitHub Desktop.
Save bborysenko/eb66fbf7c95670f184e55f790570a804 to your computer and use it in GitHub Desktop.
Obsidian Custom CSS
/* -----------------------------------------------------------------------------
Bullet Point Relationship Lines
https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/2
----------------------------------------------------------------------------- */
.cm-hmd-list-indent .cm-tab, ul ul {
position: relative;
}
.cm-hmd-list-indent .cm-tab::before, ul ul::before {
content:'';
border-left: 1px solid var(--text-accent);
position: absolute;
}
.cm-hmd-list-indent .cm-tab::before {
left: 3px;
top: -5px;
bottom: -4px;
}
ul ul::before {
left: -15px;
top: 0;
bottom: 0;
}
/* -----------------------------------------------------------------------------
Tag Pills
https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/13
https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/64
----------------------------------------------------------------------------- */
a.tag,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-hashtag-begin,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-hashtag-end {
background-color: var(--text-accent);
border: none;
color: white;
font-size: 12px;
padding: 1px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 0px 0px;
cursor: pointer;
border-radius: 12px;
}
a.tag:hover {
background-color: var(--text-accent-hover);
color: white
}
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-hashtag-begin {
display: none;
}
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-hashtag-end:before {
content: '#';
}
.tag[href^="#video"],
.tag[href^="#book"],
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-tag-video,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-tag-book {
background-color: gray;
}
/* -----------------------------------------------------------------------------
Clutter free edit mode
https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/57
----------------------------------------------------------------------------- */
/* inline formatting, link targets and [[ ]] disappears if not active line*/
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-formatting,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-string.cm-url {
display: none;
}
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-formatting-list-ul {
visibility: hidden;
position: relative;
}
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-formatting-list-ul:after {
content: "\2022";
color: var(--text-normal);
visibility: visible;
position: absolute;
left: 0;
}
/* hide all html tags -- IT IS COMMENTED OUT BY DEFAULT */
/* div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-tag{ display: none; } */
/* except list markers */ span.cm-formatting-list,
/*code block backticks */ span.cm-formatting-code-block.cm-hmd-codeblock,
/* optionally header hashes */ span.cm-formatting-header
{ display: inline !important; }
/* and task checkboxes */
span.cm-formatting-task { display: inline !important; font-family: monospace; }
/* -----------------------------------------------------------------------------
Andy Matuschak mode! modified so that the first pane is "sticky"
https://forum.obsidian.md/t/andy-matuschak-mode-v2-7-updated-for-0-7-new-panes/170/73
----------------------------------------------------------------------------- */
/* everything under .mod-root now. Don't want Andy messing with sidebars */
/* also, Andy only makes sense for vertical splits, at the root level, right? */
.mod-root.workspace-split.mod-vertical {
overflow-x: auto;
--header-width: 36px;
--pane-width: 700px;
/* <- 36px is the header height in the default theme */
--padding: 10px;
background-color: var(--background-secondary);
}
.mod-root.workspace-split.mod-vertical>div {
min-width: calc(var(--pane-width) + var(--header-width));
/* <-- 700px is the default theme's "readable" max-width */
box-shadow: 0px 0px 20px 20px rgba(0, 0, 0, 0.25);
position: sticky;
left: 0;
}
.mod-root.workspace-split.mod-vertical .workspace-leaf.mod-active,
.mod-root.workspace-split.mod-vertical>div:first-of-type {
z-index:1;
}
/* shift sticky position, so titles will stack up to the left */
/* This will currently stack to a maximum of 10 before resetting */
.mod-root.workspace-split.mod-vertical>div:not(:first-of-type) {
left: calc((var(--header-width) * 0) + var(--pane-width) + var(--header-width) + var(--padding));
margin: var(--padding);
max-height: calc(100% - var(--padding) - var(--padding));
}
/* make the fake drop target overlay have a background so you can see it. */
/* TODO: figure out how the fake target overlay works so we can put the title back, too */
.workspace-leaf:not(:first-of-type) .workspace-fake-target-overlay {
background-color: var(--background-primary);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment