Remember view mode per file

+1 Per-note Editor vs Preview mode with YAML specification would be really great!

1 Like

@Bhume My post above is only suggestion of possible implementation of original request. It is not implemented yet so it does not work.

YAML front-matter in Obsidian is documented here: YAML front matter
For more detailed introduction to YAML format see Learn yaml in Y Minutes

I’ve built a plug-in for this; will have a look to publish it as community plug-in. As suggested above: it analyzes the YAML to decide whether to display the file in PREVIEW or EDITOR mode, regardless of Obsidian’s default setting. Think of notes serving as a dashboard (and containing dataview or tasks as code blocks).

To be continued.

This

always renders, when opening or navigating to that note as follows:

4 Likes

awesome! looking forward to try it.

Would love to give this a try as well!

I came to the forums today looking for this exact feature. Looking forward to it as well :slight_smile:

Hi. Submitted a pull request: see Add obsidian-view-mode-by-frontmatter to plugin list by bwydoogh · Pull Request #411 · obsidianmd/obsidian-releases · GitHub.
Fingers crossed :slight_smile:.

1 Like

Sweet, I recently requested this…

3 Likes

Can we call the plugin Hydra?

Any joy getting this plugin published?

1 Like

+1 I hope the plugin gets approved.
I personally would like an extended version. Like locking a whole folder, or applying the lock according to certain filters/search.

This is already on my TO-DO list (setting which takes folders containing notes which should always open in a certain mode).

1 Like

I am still waiting for approval; it takes some time apparently (all remarks made by the reviewer were addressed).

1 Like

Btw, someone on a similar thread brought up that the switch can’t be in the YAML, how would you edit the frontmatter if the note was locked in Preview Mode.

Of course, you could edit the actual file in your OS, but the idea is to stay in Obsidian.

My plug-in does not lock the note; it opens the note in the specified view mode. You are still able to switch to a different mode yourself (and edit the front matter YAML).

2 Likes

Glad to solve your needs.
I modified a [colorful preview] plug-in myself, and I only need to add a mark at the end of the md document to automatically enter different modes.
Add three newlines at the end to automatically enter the editing mode when you open the file.
Add three spaces at the end to automatically enter the preview mode when opening the file.ZH多彩预览0.0.7.zip (5.4 KB)

很高兴解决你的需求。我自己修改了一个【多彩预览】插件,只需要在md文档的末尾添加标记就可以自动进入不同的模式。
在末尾添加三次换行,在打开文件时就自动进入编辑模式。
在末尾添加三个空格,在打开文件时就自动进入预览模式。

It has been approved :+1:

2 Likes

Congrats.

A bit related, I feel the current Obsidian’s toggle pane mode option doesn’t follow principle of least surprise. And they kept changing the name of the option. If it just does the reasonable thing, I won’t need this plugin.

All this does is switch the Obsidian Edit/Preview Mode to the other mode when you click on the file with the lines or spaces. You are then in that mode for all other files.

Its great that those line/space files force the mode, but then I still have to switch back when I go to another un-space-line-modified files.

Good work around for the desperate, but not exactly the solution.

Also, it might be better if the file marking was a visible character, like ppp or eee. Or make the characters a setting.

Front matter would also be better.

Sorry for complaining.

Thank you for your advice. It feels that marking with visible characters will pollute the source text. If this is necessary, you can modify the main.js plug-in file to replace the regular expression [\n {3}] with EEE and [ ] with PPP

1 Like