Skip to content

Instantly share code, notes, and snippets.

@julienma
Created February 2, 2022 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julienma/8cfff50825b5f09c1cf77b0b66f13e38 to your computer and use it in GitHub Desktop.
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
/*
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