Created
February 2, 2022 10:19
-
-
Save julienma/8cfff50825b5f09c1cf77b0b66f13e38 to your computer and use it in GitHub Desktop.
CSS snippet for Obsidian to make the Source Mode more like Typora's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tested on Obsidian 0.13.23 with theme Minimal 5.0 | |
https://github.com/kepano/obsidian-minimal | |
*/ | |
/* LIVE PREVIEW Editor */ | |
/* Use text font (serif) */ | |
.markdown-source-view.mod-cm6.is-live-preview .cm-scroller { | |
font-family: var(--text); | |
} | |
/* Hide gutter for line numbers */ | |
.markdown-source-view.mod-cm6.is-live-preview .cm-gutterElement { | |
display: none; | |
} | |
/* SOURCE Editor */ | |
/* Use monospace font */ | |
.markdown-source-view.mod-cm6 .cm-scroller{ | |
font-family: var(--font-monospace); | |
} | |
/* Hide all line numbers in the gutter... */ | |
.markdown-source-view.mod-cm6 .cm-gutterElement { | |
color: transparent; | |
} | |
/* ... but show line numbers for active / focused line, as well as first, last, and every 10th lines */ | |
.markdown-source-view.mod-cm6 .cm-gutterElement.cm-active, | |
.markdown-source-view.mod-cm6 .cm-gutterElement:nth-child(2), | |
.markdown-source-view.mod-cm6 .cm-gutterElement:last-child, | |
.markdown-source-view.mod-cm6 .cm-gutterElement:nth-child(10n+1) { | |
color: inherit; | |
} | |
/* Also "highlight" background color for active / focused line */ | |
.markdown-source-view.mod-cm6:not([class*="is-live-preview"]) .cm-line.cm-active { | |
background-color: var(--background-secondary); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment