Skip to content

Instantly share code, notes, and snippets.

@ljsherlock
Last active May 20, 2023 16:25
Show Gist options
  • Save ljsherlock/a08181f241bd0ca15b3601973f63951e to your computer and use it in GitHub Desktop.
Save ljsherlock/a08181f241bd0ca15b3601973f63951e to your computer and use it in GitHub Desktop.
Hide markdown formatting (hashes and links, and asterisks) on all unfocused lines (e.g. lines not typing on)
  1. Go to Settings > Appearance
  2. Enable "CSS Snippets" > Obsidian
  3. Go to terminal
  4. Create a CSS snippet file for Obsidian Note: the folders ".obsidian" and "snippets" should already exist, if they don't create them with "mkdir" command.
cd secondmind 
cd .obsidian
cd snippets
touch obsidian.css
#opens file in VSC
code obsidian.css 

Copy and past the following CSS to the obsidian.css file. Changes should be instant (if CSS Snippets enabled [as above]).

/* 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,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-formatting-link,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-hmd-barelink,
div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-comment
{ display: none; }

/* 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; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment