Easily switch between source mode <-> live preview <-> preview

Use case or problem

The problem is that when live preview mode is turned on, selecting the “edit/preview” toggle allows toggles only between live preview and preview modes. So if I have the live preview option turned on, I currently cannot switch to edit mode, and can’t use live preview mode if I want to use edit mode without first restarting the vault.

Proposed solution

The availability of live preview mode could instead be an optional addition to edit and preview modes - each of which can be toggled on/off as available modes in the vault. This would mean that users can have the vault have any combination of the three modes (E+LP+P / E+P / E+LP / LP+P / E / LP / P) turned on to use in the vault (although of these, it seems like nobody would use just P mode - it might still be useful for a presentation/demo, for instance).


you can, there is command palette option: toggle source mode.

@WhiteNoise I believe the idea is to be able to switch between source <-> LP <-> preview easily. Right now, if you are in preview mode, first you need to toggle back to edit (with or without LP), then toggle between source <-> LP.


Toggle source mode, as far as I have tried it, is not the same as the edit mode without the live preview toggle - it doesn’t have the CSS additions that are available to edit mode in my vault (this includes things like list styles, tag pills, etc which work on edit mode but not in either Live Preview or in the source mode if live preview is enabled).

1 Like

It does support css styling, they are different from the old edit mode.
Source mode is what you currently see on mobile. If your theme/snippets work on mobile, they will work in source mode on new desktop editor.

I agree with @argentum on keeping this FR as the ability to switch quickly between source mode <-> Live Preview <-> Preview.

As licat said multiple times, the old editor (edit mode) will still be available as a legacy option for a long while (and eventually be deprecated). Easily switching between live preview and the old edit mode won’t be supported first party. Maybe somebody can write a plugin for doing it.


Yes, that’s exactly what I’m missing.

I use a hotkey CMD+SHIFT+S to switch between the modes…

1 Like

This is not currently possible. You can only switch between Edit <-> Reading view. Or beetween modes in Edit: LP mode <-> Source mode.

But you can’t go from Reading <-> the mode you didn’t have active on Edit. So if you had Source mode, you can’t go from Reading <-> LP. You have to do Reading ->Source → LP.

i, too, configured an hotKey to go to source (i prefer working in source mode!)

anyway as i’m here: the icon to switch from editing to reading isn’t clear! you never know if you’re in editing or in preview! :slight_smile: and if i could opt-click the icon to go into source mode, it would be heaven

Hi Stefano,

Do you have this custom hotkey made in css or with a plugin? I’d like to be able to do this too (as i also prefer working in source mode) so any help will be appreciated!

i just mapped the command to Cmd+Shift+E
we don’t have any visual clue in what state we are, but it works!

in vanilla obsidian there are 2 by default.

@StefanoCecere @AriesOdyssey you can switch between all three modes with a bit of javascript. If you put this in a Templater template, you can add it as a hotkey. Or any other plugin you prefer to launch arbitrary JS.

Source mode

const view = app.workspace.activeLeaf.getViewState()
view.state.mode = 'source'
view.state.source = true

Live preview

const view = app.workspace.activeLeaf.getViewState()
view.state.mode = 'source'
view.state.source = false

Reading mode

const view = app.workspace.activeLeaf.getViewState()
view.state.mode = 'preview'

I spend most of my time in Reading mode, but I use the above to switch to editing mode automatically when inserting a template. I just put the code at the end of the template.