bwydoogh78k downloadsForce the view mode for a note by using frontmatter: YAML block with 'obsidian_ui_mode' as key.
This plug-in allows you to indicate through front matter that a note should always be opened in a certain view mode or editing mode.
From within Obsidian:
Manually:
main.js, manifest.json and styles.css from the latest release.<your vault>/.obsidian/plugins/obsidian-view-mode-by-frontmatter/.The plug-in requires Obsidian 1.1.0 or later. Release assets come with artifact attestations; verify a download with gh attestation verify main.js --repo bwydoogh/obsidian-force-view-mode-of-note.
Changing the view mode can be done through the key obsidianUIMode, which can have the value source (editing view) or preview (reading view). Changing the editing mode happens by declaring the key obsidianEditingMode; it takes live (live preview) or source (source mode) as value.
| You want | Front matter |
|---|---|
| Reading view | obsidianUIMode: preview |
| Editing view, live preview | obsidianUIMode: source + obsidianEditingMode: live |
| Editing view, source mode | obsidianUIMode: source + obsidianEditingMode: source |
When only obsidianUIMode: preview is set (in front matter or through a folder or file rule), switching to editing uses the obsidianEditingMode of the note if it has one, and Obsidian's default editing mode otherwise.
Example: add below snippet (front matter) to your note ...
---
obsidianUIMode: source
obsidianEditingMode: live
---
... and this will force the note to open in "live preview" edit mode.
Similar, ... add below snippet to your note ...
---
obsidianUIMode: preview
---
... and this will always open the note in reading view (Obsidian calls this mode preview internally).
Under Settings → Force note view mode you can force a mode without touching the notes themselves:
- All$ for notes ending in " - All" or 1900-01 for daily notes starting with "1900-01".Rules take precedence over front matter, and file rules take precedence over folder rules. Within a list, a lower rule wins over a higher one, so put child folders below their parent folder. Choose default to leave the matching notes alone.
This plug-in also ensures that a note is always opened in the configured default mode (suppose the Obsidian setting has "preview" as default mode but the pane is currently in "source" mode, then opening a new note in that same pane will open in "preview" mode).