mirror of
https://github.com/obsidian-nvim/obsidian.nvim.git
synced 2026-11-17 03:00:32 +00:00
Page:
Frontmatter
Pages
Actions
Attachment
Audio recorder
Autocmds
Bookmarks
Breaking Changes
Cache
Checkbox
Commands
Completion
Daily Notes
Editing this wiki
Extensions
File
Folding
Footer
Frontmatter
Home
Images
Integrations
Keymaps
LSP Progress
LSP
Link
Navigation
Note
Open
Recipes
Resolvers
Scripting
Search
Startup Guide
Statusline
Sync
Tag
Template
Unique Note
Workspace
No results
5
Frontmatter
github-actions edited this page 2026-04-05 17:44:33 +00:00
Table of contents
obsidian.nvim reads YAML frontmatter at the top of a note (between --- lines). It validates a small set of keys used by the plugin and leaves any other fields untouched as metadata.
Special keys
id: string or numberaliases: string or list of stringstags: string or list of strings
Invalid types are ignored with a warning.
Syntax
- See Obsidian's docs on property format
- For multiline strings, use block
|syntax to denote start of a multiline string
description: |
obsidian app is an electron app
obsidian.nvim is a neovim plugin
Example
---
id: 2024-09-01
aliases:
- "Weekly review"
tags: [work, planning]
status: draft
---
Disabling frontmatter
If you do not want frontmatter parsing for a workspace, set frontmatter.enabled = false.
require("obsidian").setup {
frontmatter = { enabled = false }, -- globally
workspaces = {
{
path = "~/Documents/Notes",
name = "Notes",
overrides = {
frontmatter = { enabled = false }, -- for this workspace
},
},
},
}
Optionally enabled can also take a function that received the note filename and returns a boolean:
require("obsidian").setup {
frontmatter = {
enabled = function(path)
if vim.endswith(tostring(path), ".qmd") then -- disables the frontmatter when it is quarto file
return false
end
return true
end,
},
}
Warning
this signature of this callback could change in the future.
Sorting frontmatter
TODO:
Options
---@class obsidian.config.FrontmatterOpts
---
--- Whether to enable frontmatter, boolean for global on/off, or a function that takes filename and returns boolean.
---@field enabled? (fun(fname: string?): boolean)|boolean
---
--- Function to turn Note attributes into frontmatter.
---@field func? fun(note: obsidian.Note): table<string, any>
--- Function that is passed to table.sort to sort the properties, or a fixed order of properties.
---
--- List of string that sorts frontmatter properties, or a function that compares two values, set to vim.NIL/false to do no sorting
---@field sort? string[] | (fun(a: any, b: any): boolean) | vim.NIL | boolean
frontmatter = {
enabled = true,
func = require("obsidian.builtin").frontmatter,
sort = { "id", "aliases", "tags" },
}
🌟 obsidian.nvim
Topics
- Actions
- Autocmds
- Commands
- Folding
- Extensions
- Images
- Integrations
- Keymaps
- Navigation
- Scripting
- Startup-Guide
- Recipes
- LSP
- LSP-Progress