*obsidian-api*

The Obsidian.nvim Lua API.

==============================================================================

Table of contents

  obsidian.Client............................................|obsidian.Client|
  
  obsidian.Note................................................|obsidian.Note|
  
  obsidian.Workspace......................................|obsidian.Workspace|
  
  obsidian.Path................................................|obsidian.Path|
  
------------------------------------------------------------------------------
                                                           *obsidian.SearchOpts*
                                  `SearchOpts`
Class ~
{obsidian.SearchOpts} : obsidian.ABC

Fields ~
{sort} `(boolean|?)`
{include_templates} `(boolean|?)`
{ignore_case} `(boolean|?)`

------------------------------------------------------------------------------
                                                *obsidian.SearchOpts.from_tbl()*
                         `SearchOpts.from_tbl`({opts})
Parameters ~
{opts} `(obsidian.SearchOpts|table<string, any>)`

Return ~
obsidian.SearchOpts

------------------------------------------------------------------------------
                                                 *obsidian.SearchOpts.default()*
                             `SearchOpts.default`()
Return ~
obsidian.SearchOpts

------------------------------------------------------------------------------
                                                               *obsidian.Client*
                                    `Client`
The Obsidian client is the main API for programmatically interacting with obsidian.nvim's features
in Lua. To get the client instance, run:

`local client = require("obsidian").get_client()`

Class ~
{obsidian.Client} : obsidian.ABC

Fields ~
{current_workspace} obsidian.Workspace The current workspace.
{dir} obsidian.Path The root of the vault for the current workspace.
{opts} obsidian.config.ClientOpts The client config.
{buf_dir} obsidian.Path|? The parent directory of the current buffer.
{callback_manager} obsidian.CallbackManager
{log} obsidian.Logger
{_default_opts} obsidian.config.ClientOpts
{_quiet} `(boolean)`

------------------------------------------------------------------------------
                                                         *obsidian.Client.new()*
                              `Client.new`({opts})
Create a new Obsidian client without additional setup.
This is mostly used for testing. In practice you usually want to obtain the existing
client through:

`require("obsidian").get_client()`

Parameters ~
{opts} obsidian.config.ClientOpts

Return ~
obsidian.Client

------------------------------------------------------------------------------
                                               *obsidian.Client.set_workspace()*
              `Client.set_workspace`({self}, {workspace}, {opts})
Parameters ~
{workspace} obsidian.Workspace
{opts} { lock: `(boolean|?)` }|?

------------------------------------------------------------------------------
                                          *obsidian.Client.opts_for_workspace()*
                `Client.opts_for_workspace`({self}, {workspace})
Get the normalize opts for a given workspace.

Parameters ~
{workspace} obsidian.Workspace|?

Return ~
obsidian.config.ClientOpts

------------------------------------------------------------------------------
                                            *obsidian.Client.switch_workspace()*
             `Client.switch_workspace`({self}, {workspace}, {opts})
Switch to a different workspace.

Parameters ~
{workspace} `(obsidian.Workspace|string)` The workspace object or the name of an existing workspace.
{opts} { lock: `(boolean|?)` }|?

------------------------------------------------------------------------------
                                                *obsidian.Client.path_is_note()*
               `Client.path_is_note`({self}, {path}, {workspace})
Check if a path represents a note in the workspace.

Parameters ~
{path} `(string|obsidian.Path)`
{workspace} obsidian.Workspace|?

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                  *obsidian.Client.vault_root()*
                    `Client.vault_root`({self}, {workspace})
Get the absolute path to the root of the Obsidian vault for the given workspace or the
current workspace.

Parameters ~
{workspace} obsidian.Workspace|?

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                  *obsidian.Client.vault_name()*
                          `Client.vault_name`({self})
Get the name of the current vault.

Return ~
`(string)`

------------------------------------------------------------------------------
                                         *obsidian.Client.vault_relative_path()*
              `Client.vault_relative_path`({self}, {path}, {opts})
Make a path relative to the vault root, if possible.

Parameters ~
{path} `(string|obsidian.Path)`
{opts} { strict: `(boolean|?)` }|?

Return ~
obsidian.Path| `(optional)`

------------------------------------------------------------------------------
                                               *obsidian.Client.templates_dir()*
                  `Client.templates_dir`({self}, {workspace})
Get the templates folder.

Parameters ~
{workspace} obsidian.Workspace|?

Return ~
obsidian.Path| `(optional)`

------------------------------------------------------------------------------
                                     *obsidian.Client.should_save_frontmatter()*
                `Client.should_save_frontmatter`({self}, {note})
Determines whether a note's frontmatter is managed by obsidian.nvim.

Parameters ~
{note} obsidian.Note

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                     *obsidian.Client.command()*
                `Client.command`({self}, {cmd_name}, {cmd_data})
Run an obsidian command directly.

Usage ~
`client:command("ObsidianNew", { args = "Foo" })`

Parameters ~
{cmd_name} `(string)` The name of the command.
{cmd_data} `(table|?)` The payload for the command.

------------------------------------------------------------------------------
                                             *obsidian.Client.search_defaults()*
                        `Client.search_defaults`({self})
Get the default search options.

Return ~
obsidian.SearchOpts

------------------------------------------------------------------------------
                                                  *obsidian.Client.find_notes()*
                  `Client.find_notes`({self}, {term}, {opts})
Find notes matching the given term. Notes are searched based on ID, title, filename, and aliases.

Parameters ~
{term} `(string)` The term to search for
{opts} { search: obsidian.SearchOpts|?, notes: obsidian.note.LoadOpts|?, timeout: `(integer|?)` }|?

Return ~
obsidian.Note[]

------------------------------------------------------------------------------
                                            *obsidian.Client.find_notes_async()*
         `Client.find_notes_async`({self}, {term}, {callback}, {opts})
An async version of `find_notes()` that runs the callback with an array of all matching notes.

Parameters ~
{term} `(string)` The term to search for
{callback} `(fun(notes: obsidian.Note[]))`
{opts} { search: obsidian.SearchOpts|?, notes: obsidian.note.LoadOpts|? }|?

------------------------------------------------------------------------------
                                                  *obsidian.Client.find_files()*
                  `Client.find_files`({self}, {term}, {opts})
Find non-markdown files in the vault.

Parameters ~
{term} `(string)` The search term.
{opts} { search: obsidian.SearchOpts, timeout: `(integer|?)` }|?

Return ~
obsidian.Path[]

------------------------------------------------------------------------------
                                            *obsidian.Client.find_files_async()*
         `Client.find_files_async`({self}, {term}, {callback}, {opts})
An async version of `find_files`.

Parameters ~
{term} `(string)` The search term.
{callback} `(fun(paths: obsidian.Path[]))`
{opts} { search: obsidian.SearchOpts }|?

------------------------------------------------------------------------------
                                                *obsidian.Client.resolve_note()*
                 `Client.resolve_note`({self}, {query}, {opts})
Resolve the query to a single note if possible, otherwise all close matches are returned.
The 'query' can be a path, filename, note ID, alias, title, etc.

Parameters ~
{query} `(string)`
{opts} { timeout: `(integer|?,)` notes: obsidian.note.LoadOpts|? }|?

Return ~
obsidian.Note `(...)`

------------------------------------------------------------------------------
                                          *obsidian.Client.resolve_note_async()*
        `Client.resolve_note_async`({self}, {query}, {callback}, {opts})
An async version of `resolve_note()`.

Parameters ~
{query} `(string)`
{callback} `(fun(...: obsidian.Note))`
{opts} { notes: obsidian.note.LoadOpts|? }|?

Return ~
obsidian.Note| `(optional)`

------------------------------------------------------------------------------
                     *obsidian.Client.resolve_note_async_with_picker_fallback()*
`Client.resolve_note_async_with_picker_fallback`({self}, {query}, {callback}, {opts})
Same as `resolve_note_async` but opens a picker to choose a single note when
there are multiple matches.

Parameters ~
{query} `(string)`
{callback} `(fun(obsidian.Note))`
{opts} { notes: obsidian.note.LoadOpts|?, prompt_title: `(string|?)` }|?

Return ~
obsidian.Note| `(optional)`

------------------------------------------------------------------------------
Class ~
{obsidian.ResolveLinkResult}

Fields ~
{location} `(string)`
{name} `(string)`
{link_type} obsidian.search.RefTypes
{path} obsidian.Path|?
{note} obsidian.Note|?
{url} `(string|?)`
{line} `(integer|?)`
{col} `(integer|?)`
{anchor} obsidian.note.HeaderAnchor|?
{block} obsidian.note.Block|?

------------------------------------------------------------------------------
                                          *obsidian.Client.resolve_link_async()*
            `Client.resolve_link_async`({self}, {link}, {callback})
Resolve a link. If the link argument is `nil` we attempt to resolve a link under the cursor.

Parameters ~
{link} `(string|?)`
{callback} `(fun(...: obsidian.ResolveLinkResult))`

------------------------------------------------------------------------------
                                           *obsidian.Client.follow_link_async()*
               `Client.follow_link_async`({self}, {link}, {opts})
Follow a link. If the link argument is `nil` we attempt to follow a link under the cursor.

Parameters ~
{link} `(string|?)`
{opts} { open_strategy: obsidian.config.OpenStrategy|? }|?

------------------------------------------------------------------------------
                                                   *obsidian.Client.open_note()*
               `Client.open_note`({self}, {note_or_path}, {opts})
Open a note in a buffer.

Parameters ~
{note_or_path} `(string|obsidian.Path|obsidian.Note)`
{opts} { line: `(integer|?,)` col: integer|?, open_strategy: obsidian.config.OpenStrategy|?, sync: boolean|?, callback: fun(bufnr: integer)|? }|?

------------------------------------------------------------------------------
                                                *obsidian.Client.current_note()*
                 `Client.current_note`({self}, {bufnr}, {opts})
Get the current note from a buffer.

Parameters ~
{bufnr} `(integer|?)`
{opts} obsidian.note.LoadOpts|?

Return ~
obsidian.Note| `(optional)`

------------------------------------------------------------------------------
Class ~
{obsidian.TagLocation}

Fields ~
{tag} `(string)` The tag found.
{note} obsidian.Note The note instance where the tag was found.
{path} `(string|obsidian.Path)` The path to the note where the tag was found.
{line} `(integer)` The line number (1-indexed) where the tag was found.
{text} `(string)` The text (with whitespace stripped) of the line where the tag was found.
{tag_start} `(integer|?)` The index within 'text' where the tag starts.
{tag_end} `(integer|?)` The index within 'text' where the tag ends.

------------------------------------------------------------------------------
                                                   *obsidian.Client.find_tags()*
                   `Client.find_tags`({self}, {term}, {opts})
Find all tags starting with the given search term(s).

Parameters ~
{term} `(string|string[])` The search term.
{opts} { search: obsidian.SearchOpts|?, timeout: `(integer|?)` }|?

Return ~
obsidian.TagLocation[]

------------------------------------------------------------------------------
                                             *obsidian.Client.find_tags_async()*
          `Client.find_tags_async`({self}, {term}, {callback}, {opts})
An async version of 'find_tags()'.

Parameters ~
{term} `(string|string[])` The search term.
{callback} `(fun(tags: obsidian.TagLocation[]))`
{opts} { search: obsidian.SearchOpts }|?

------------------------------------------------------------------------------
Class ~
{obsidian.BacklinkMatches}

Fields ~
{note} obsidian.Note The note instance where the backlinks were found.
{path} `(string|obsidian.Path)` The path to the note where the backlinks were found.
{matches} obsidian.BacklinkMatch[] The backlinks within the note.

------------------------------------------------------------------------------
Class ~
{obsidian.BacklinkMatch}

Fields ~
{line} `(integer)` The line number (1-indexed) where the backlink was found.
{text} `(string)` The text of the line where the backlink was found.

------------------------------------------------------------------------------
                                              *obsidian.Client.find_backlinks()*
                `Client.find_backlinks`({self}, {note}, {opts})
Find all backlinks to a note.

Parameters ~
{note} obsidian.Note The note to find backlinks for.
{opts} { search: obsidian.SearchOpts|?, timeout: `(integer|?,)` anchor: string|?, block: string|? }|?

Return ~
obsidian.BacklinkMatches[]

------------------------------------------------------------------------------
                                        *obsidian.Client.find_backlinks_async()*
       `Client.find_backlinks_async`({self}, {note}, {callback}, {opts})
An async version of 'find_backlinks()'.

Parameters ~
{note} obsidian.Note The note to find backlinks for.
{callback} `(fun(backlinks: obsidian.BacklinkMatches[]))`
{opts} { search: obsidian.SearchOpts, anchor: `(string|?,)` block: string|? }|?

------------------------------------------------------------------------------
                                                   *obsidian.Client.list_tags()*
                 `Client.list_tags`({self}, {term}, {timeout})
Gather a list of all tags in the vault. If 'term' is provided, only tags that partially match the search
term will be included.

Parameters ~
{term} `(string|?)` An optional search term to match tags
{timeout} `(integer|?)` Timeout in milliseconds

Return ~
`(string[])`

------------------------------------------------------------------------------
                                             *obsidian.Client.list_tags_async()*
              `Client.list_tags_async`({self}, {term}, {callback})
An async version of 'list_tags()'.

Parameters ~
{term} `(string|?)`
{callback} `(fun(tags: string[]))`

------------------------------------------------------------------------------
                                                 *obsidian.Client.apply_async()*
                `Client.apply_async`({self}, {on_note}, {opts})
Apply a function over all notes in the current vault.

Parameters ~
{on_note} `(fun(note: obsidian.Note))`
{opts} { on_done: `(fun()|?,)` timeout: integer|?, pattern: string|? }|?

Options:
 - `on_done`: A function to call when all notes have been processed.
 - `timeout`: An optional timeout.
 - `pattern`: A Lua search pattern. Defaults to ".*%.md".

------------------------------------------------------------------------------
                                             *obsidian.Client.apply_async_raw()*
              `Client.apply_async_raw`({self}, {on_path}, {opts})
Like apply, but the callback takes a path instead of a note instance.

Parameters ~
{on_path} `(fun(path: string))`
{opts} { on_done: `(fun()|?,)` timeout: integer|?, pattern: string|? }|?

Options:
 - `on_done`: A function to call when all paths have been processed.
 - `timeout`: An optional timeout.
 - `pattern`: A Lua search pattern. Defaults to ".*%.md".

------------------------------------------------------------------------------
                                                 *obsidian.Client.new_note_id()*
                     `Client.new_note_id`({self}, {title})
Generate a unique ID for a new note. This respects the user's `note_id_func` if configured,
otherwise falls back to generated a Zettelkasten style ID.

Parameters ~
{title} `(string|?)`

Return ~
`(string)`

------------------------------------------------------------------------------
                                               *obsidian.Client.new_note_path()*
                     `Client.new_note_path`({self}, {spec})
Generate the file path for a new note given its ID, parent directory, and title.
This respects the user's `note_path_func` if configured, otherwise essentially falls back to
`spec.dir / (spec.id .. ".md")`.

Parameters ~
{spec} { id: `(string,)` dir: obsidian.Path, title: string|? }

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                         *obsidian.Client.parse_title_id_path()*
           `Client.parse_title_id_path`({self}, {title}, {id}, {dir})
Parse the title, ID, and path for a new note.

Parameters ~
{title} `(string|?)`
{id} `(string|?)`
{dir} `(string|obsidian.Path|?)`

Return ~
`(string|)` `(optional)`,string,obsidian.Path

------------------------------------------------------------------------------
                                                    *obsidian.Client.new_note()*
           `Client.new_note`({self}, {title}, {id}, {dir}, {aliases})
Create and save a new note.
Deprecated: prefer `Client:create_note()` instead.

Parameters ~
{title} `(string|?)` The title for the note.
{id} `(string|?)` An optional ID for the note. If not provided one will be generated.
{dir} `(string|obsidian.Path|?)` An optional directory to place the note. If this is a relative path it will be interpreted relative the workspace / vault root.
{aliases} `(string[]|?)` Additional aliases to assign to the note.

Return ~
obsidian.Note

------------------------------------------------------------------------------
Class ~
{obsidian.CreateNoteOpts}

Fields ~
{title} `(string|?)`
{id} `(string|?)`
{dir} `(string|obsidian.Path|?)`
{aliases} `(string[]|?)`
{tags} `(string[]|?)`
{no_write} `(boolean|?)`
{template} `(string|?)`

------------------------------------------------------------------------------
                                                 *obsidian.Client.create_note()*
                      `Client.create_note`({self}, {opts})
Create a new note with the following options.

Parameters ~
{opts} obsidian.CreateNoteOpts|? Options.

Options:
 - `title`: A title to assign the note.
 - `id`: An ID to assign the note. If not specified one will be generated.
 - `dir`: An optional directory to place the note in. Relative paths will be interpreted
   relative to the workspace / vault root. If the directory doesn't exist it will be created,
   regardless of the value of the `no_write` option.
 - `aliases`: Additional aliases to assign to the note.
 - `tags`: Additional tags to assign to the note.
 - `no_write`: Don't write the note to disk.
 - `template`: The name of a template to apply when writing the note to disk.

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                  *obsidian.Client.write_note()*
                  `Client.write_note`({self}, {note}, {opts})
Write the note to disk.

Parameters ~
{note} obsidian.Note
{opts} { path: `(string|obsidian.Path,)` template: string|?, update_content: (fun(lines: string[]): string[])|? }|? Options.

Options:
 - `path`: Override the path to write to.
 - `template`: The name of a template to use if the note file doesn't already exist.
 - `update_content`: A function to update the contents of the note. This takes a list of lines
   representing the text to be written excluding frontmatter, and returns the lines that will
   actually be written (again excluding frontmatter).

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                        *obsidian.Client.write_note_to_buffer()*
             `Client.write_note_to_buffer`({self}, {note}, {opts})
Write the note to a buffer.

Parameters ~
{note} obsidian.Note
{opts} { bufnr: `(integer|?,)` template: string|? }|? Options.

Options:
 - `bufnr`: Override the buffer to write to. Defaults to current buffer.
 - `template`: The name of a template to use if the buffer is empty.

Return ~
`(boolean)` updated If the buffer was updated.

------------------------------------------------------------------------------
                                          *obsidian.Client.update_frontmatter()*
              `Client.update_frontmatter`({self}, {note}, {bufnr})
Update the frontmatter in a buffer for the note.

Parameters ~
{note} obsidian.Note
{bufnr} `(integer|?)`

Return ~
`(boolean)` updated If the the frontmatter was updated.

------------------------------------------------------------------------------
                                             *obsidian.Client.daily_note_path()*
                  `Client.daily_note_path`({self}, {datetime})
Get the path to a daily note.

Parameters ~
{datetime} `(integer|?)`

Return ~
obsidian.Path, `(string)` (Path, ID) The path and ID of the note.

------------------------------------------------------------------------------
                                                       *obsidian.Client.today()*
                             `Client.today`({self})
Open (or create) the daily note for today.

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                   *obsidian.Client.yesterday()*
                           `Client.yesterday`({self})
Open (or create) the daily note from the last weekday.

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                    *obsidian.Client.tomorrow()*
                           `Client.tomorrow`({self})
Open (or create) the daily note for the next weekday.

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                       *obsidian.Client.daily()*
                 `Client.daily`({self}, {offset_days}, {opts})
Open (or create) the daily note for today + `offset_days`.

Parameters ~
{offset_days} `(integer|?)`
{opts} { no_write: `(boolean|?,)` load: obsidian.note.LoadOpts|? }|?

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                   *obsidian.Client.update_ui()*
                      `Client.update_ui`({self}, {bufnr})
Manually update extmarks in a buffer.

Parameters ~
{bufnr} `(integer|?)`

------------------------------------------------------------------------------
                                                 *obsidian.Client.format_link()*
                  `Client.format_link`({self}, {note}, {opts})
Create a formatted markdown / wiki link for a note.

Parameters ~
{note} `(obsidian.Note|obsidian.Path|string)` The note/path to link to.
{opts} { label: `(string|?,)` link_style: obsidian.config.LinkStyle|?, id: string|integer|?, anchor: obsidian.note.HeaderAnchor|?, block: obsidian.note.Block|? }|? Options.

Return ~
`(string)`

------------------------------------------------------------------------------
                                                      *obsidian.Client.picker()*
                     `Client.picker`({self}, {picker_name})
Get the Picker.

Parameters ~
{picker_name} obsidian.config.Picker|?

Return ~
obsidian.Picker| `(optional)`

------------------------------------------------------------------------------
Class ~
{obsidian.note.HeaderAnchor}

Fields ~
{anchor} `(string)`
{header} `(string)`
{level} `(integer)`
{line} `(integer)`
{parent} obsidian.note.HeaderAnchor|?

------------------------------------------------------------------------------
Class ~
{obsidian.note.Block}

Fields ~
{id} `(string)`
{line} `(integer)`
{block} `(string)`

------------------------------------------------------------------------------
                                                                 *obsidian.Note*
                                     `Note`
A class that represents a note within a vault.

Class ~
{obsidian.Note} : obsidian.ABC

Fields ~
{id} `(string|integer)`
{aliases} `(string[])`
{title} `(string|?)`
{tags} `(string[])`
{path} obsidian.Path|?
{metadata} `(table|?)`
{has_frontmatter} `(boolean|?)`
{frontmatter_end_line} `(integer|?)`
{contents} `(string[]|?)`
{anchor_links} `(table<string, obsidian.note.HeaderAnchor>|?)`
{blocks} `(table<string, obsidian.note.Block>?)`
{alt_alias} `(string|?)`
{bufnr} `(integer|?)`

------------------------------------------------------------------------------
                                                           *obsidian.Note.new()*
                  `Note.new`({id}, {aliases}, {tags}, {path})
Create new note object.

Keep in mind that you have to call `note:save(...)` to create/update the note on disk.

Parameters ~
{id} `(string|number)`
{aliases} `(string[])`
{tags} `(string[])`
{path} `(string|obsidian.Path|?)`

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                  *obsidian.Note.display_info()*
                      `Note.display_info`({self}, {opts})
Get markdown display info about the note.

Parameters ~
{opts} { label: `(string|?,)` anchor: obsidian.note.HeaderAnchor|?, block: obsidian.note.Block|? }|?

Return ~
`(string)`

------------------------------------------------------------------------------
                                                        *obsidian.Note.exists()*
                             `Note.exists`({self})
Check if the note exists on the file system.

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                         *obsidian.Note.fname()*
                              `Note.fname`({self})
Get the filename associated with the note.

Return ~
`(string|)` `(optional)`

------------------------------------------------------------------------------
                                                 *obsidian.Note.reference_ids()*
                      `Note.reference_ids`({self}, {opts})
Get a list of all of the different string that can identify this note via references,
including the ID, aliases, and filename.
Parameters ~
{opts} { lowercase: `(boolean|?)` }|?
Return ~
`(string[])`

------------------------------------------------------------------------------
                                                     *obsidian.Note.has_alias()*
                       `Note.has_alias`({self}, {alias})
Check if a note has a given alias.

Parameters ~
{alias} `(string)`

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                       *obsidian.Note.has_tag()*
                         `Note.has_tag`({self}, {tag})
Check if a note has a given tag.

Parameters ~
{tag} `(string)`

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                     *obsidian.Note.add_alias()*
                       `Note.add_alias`({self}, {alias})
Add an alias to the note.

Parameters ~
{alias} `(string)`

Return ~
`(boolean)` added True if the alias was added, false if it was already present.

------------------------------------------------------------------------------
                                                       *obsidian.Note.add_tag()*
                         `Note.add_tag`({self}, {tag})
Add a tag to the note.

Parameters ~
{tag} `(string)`

Return ~
`(boolean)` added True if the tag was added, false if it was already present.

------------------------------------------------------------------------------
                                                     *obsidian.Note.add_field()*
                    `Note.add_field`({self}, {key}, {value})
Add or update a field in the frontmatter.

Parameters ~
{key} `(string)`
{value} `(any)`

------------------------------------------------------------------------------
                                                     *obsidian.Note.get_field()*
                        `Note.get_field`({self}, {key})
Get a field in the frontmatter.

Parameters ~
{key} `(string)`

Return ~
`(any)` result

------------------------------------------------------------------------------
Class ~
{obsidian.note.LoadOpts}
Fields ~
{max_lines} `(integer|?)`
{load_contents} `(boolean|?)`
{collect_anchor_links} `(boolean|?)`
{collect_blocks} `(boolean|?)`

------------------------------------------------------------------------------
                                                     *obsidian.Note.from_file()*
                        `Note.from_file`({path}, {opts})
Initialize a note from a file.

Parameters ~
{path} `(string|obsidian.Path)`
{opts} obsidian.note.LoadOpts|?

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                               *obsidian.Note.from_file_async()*
                     `Note.from_file_async`({path}, {opts})
An async version of `.from_file()`, i.e. it needs to be called in an async context.

Parameters ~
{path} `(string|obsidian.Path)`
{opts} obsidian.note.LoadOpts|?

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                 *obsidian.Note.from_file_with_contents_async()*
              `Note.from_file_with_contents_async`({path}, {opts})
Like `.from_file_async()` but also returns the contents of the file as a list of lines.

Parameters ~
{path} `(string|obsidian.Path)`
{opts} obsidian.note.LoadOpts|?

Return ~
`(obsidian.Note,string[])`

------------------------------------------------------------------------------
                                                   *obsidian.Note.from_buffer()*
                      `Note.from_buffer`({bufnr}, {opts})
Initialize a note from a buffer.

Parameters ~
{bufnr} `(integer|?)`
{opts} obsidian.note.LoadOpts|?

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                  *obsidian.Note.display_name()*
                          `Note.display_name`({self})
Get the display name for note.

Return ~
`(string)`

------------------------------------------------------------------------------
                                                    *obsidian.Note.from_lines()*
                   `Note.from_lines`({lines}, {path}, {opts})
Initialize a note from an iterator of lines.

Parameters ~
{lines} `(fun(): string|?)`
{path} `(string|obsidian.Path)`
{opts} obsidian.note.LoadOpts|?

Return ~
obsidian.Note

------------------------------------------------------------------------------
                                                   *obsidian.Note.frontmatter()*
                           `Note.frontmatter`({self})
Get the frontmatter table to save.

Return ~
`(table)`

------------------------------------------------------------------------------
                                             *obsidian.Note.frontmatter_lines()*
             `Note.frontmatter_lines`({self}, {eol}, {frontmatter})
Get frontmatter lines that can be written to a buffer.

Parameters ~
{eol} `(boolean|?)`
{frontmatter} `(table|?)`

Return ~
`(string[])`

------------------------------------------------------------------------------
                                                          *obsidian.Note.save()*
                          `Note.save`({self}, {opts})
Save the note to a file.
In general this only updates the frontmatter and header, leaving the rest of the contents unchanged
unless you use the `update_content()` callback.

Parameters ~
{opts} { path: `(string|obsidian.Path|?,)` insert_frontmatter: boolean|?, frontmatter: table|?, update_content: (fun(lines: string[]): string[])|? }|? Options.

Options:
 - `path`: Specify a path to save to. Defaults to `self.path`.
 - `insert_frontmatter`: Whether to insert/update frontmatter. Defaults to `true`.
 - `frontmatter`: Override the frontmatter. Defaults to the result of `self:frontmatter()`.
 - `update_content`: A function to update the contents of the note. This takes a list of lines
   representing the text to be written excluding frontmatter, and returns the lines that will
   actually be written (again excluding frontmatter).

------------------------------------------------------------------------------
                                                *obsidian.Note.save_to_buffer()*
                     `Note.save_to_buffer`({self}, {opts})
Save frontmatter to the given buffer.

Parameters ~
{opts} { bufnr: `(integer|?,)` insert_frontmatter: boolean|?, frontmatter: table|? }|? Options.

Return ~
`(boolean)` updated True if the buffer lines were updated, false otherwise.

------------------------------------------------------------------------------
                                           *obsidian.Note.resolve_anchor_link()*
               `Note.resolve_anchor_link`({self}, {anchor_link})
Try to resolve an anchor link to a line number in the note's file.

Parameters ~
{anchor_link} `(string)`
Return ~
obsidian.note.HeaderAnchor| `(optional)`

------------------------------------------------------------------------------
                                                 *obsidian.Note.resolve_block()*
                    `Note.resolve_block`({self}, {block_id})
Try to resolve a block identifier.

Parameters ~
{block_id} `(string)`

Return ~
obsidian.note.Block| `(optional)`

------------------------------------------------------------------------------
Class ~
{obsidian.workspace.WorkspaceSpec}

Fields ~
{path} `(string|obsidian.Path|(fun():)` string|obsidian.Path)
{name} `(string|?)`
{strict} `(boolean|?)` If true, the workspace root will be fixed to 'path' instead of the vault root (if different).
{overrides} `(table|obsidian.config.ClientOpts|?)`

------------------------------------------------------------------------------
Class ~
{obsidian.workspace.WorkspaceOpts}

Fields ~
{name} `(string|?)`
{strict} `(boolean|?)` If true, the workspace root will be fixed to 'path' instead of the vault root (if different).
{overrides} `(table|obsidian.config.ClientOpts|?)`

------------------------------------------------------------------------------
                                                            *obsidian.Workspace*
                                  `Workspace`
Each workspace represents a working directory (usually an Obsidian vault) along with
a set of configuration options specific to the workspace.

Workspaces are a little more general than Obsidian vaults as you can have a workspace
outside of a vault or as a subdirectory of a vault.

Class ~
{obsidian.Workspace} : obsidian.ABC

Fields ~
{name} `(string)` An arbitrary name for the workspace.
{path} obsidian.Path The normalized path to the workspace.
{root} obsidian.Path The normalized path to the vault root of the workspace. This usually matches 'path'.
{overrides} `(table|obsidian.config.ClientOpts|?)`
{locked} `(boolean|?)`

------------------------------------------------------------------------------
                                                    *obsidian.find_vault_root()*
                         `find_vault_root`({base_dir})
Find the vault root from a given directory.

This will traverse the directory tree upwards until a '.obsidian/' folder is found to
indicate the root of a vault, otherwise the given directory is used as-is.

Parameters ~
{base_dir} `(string|obsidian.Path)`

Return ~
obsidian.Path| `(optional)`

------------------------------------------------------------------------------
                                                      *obsidian.Workspace.new()*
                        `Workspace.new`({path}, {opts})
Create a new 'Workspace' object. This assumes the workspace already exists on the filesystem.

Parameters ~
{path} `(string|obsidian.Path)` Workspace path.
{opts} obsidian.workspace.WorkspaceOpts|?

Return ~
obsidian.Workspace

------------------------------------------------------------------------------
                                            *obsidian.Workspace.new_from_spec()*
                       `Workspace.new_from_spec`({spec})
Initialize a new 'Workspace' object from a workspace spec.

Parameters ~
{spec} obsidian.workspace.WorkspaceSpec

Return ~
obsidian.Workspace

------------------------------------------------------------------------------
                                             *obsidian.Workspace.new_from_cwd()*
                        `Workspace.new_from_cwd`({opts})
Initialize a 'Workspace' object from the current working directory.

Parameters ~
{opts} obsidian.workspace.WorkspaceOpts|?

Return ~
obsidian.Workspace

------------------------------------------------------------------------------
                                             *obsidian.Workspace.new_from_buf()*
                   `Workspace.new_from_buf`({bufnr}, {opts})
Initialize a 'Workspace' object from the parent directory of the current buffer.

Parameters ~
{bufnr} `(integer|?)`
{opts} obsidian.workspace.WorkspaceOpts|?

Return ~
obsidian.Workspace

------------------------------------------------------------------------------
                                                     *obsidian.Workspace.lock()*
                            `Workspace.lock`({self})
Lock the workspace.

------------------------------------------------------------------------------
                                                  *obsidian.Workspace._unlock()*
                          `Workspace._unlock`({self})
Unlock the workspace.

------------------------------------------------------------------------------
                                    *obsidian.Workspace.get_workspace_for_dir()*
           `Workspace.get_workspace_for_dir`({cur_dir}, {workspaces})
Get the workspace corresponding to the directory (or a parent of), if there
is one.

Parameters ~
{cur_dir} `(string|obsidian.Path)`
{workspaces} obsidian.workspace.WorkspaceSpec[]

Return ~
obsidian.Workspace| `(optional)`

------------------------------------------------------------------------------
                                    *obsidian.Workspace.get_workspace_for_cwd()*
                `Workspace.get_workspace_for_cwd`({workspaces})
Get the workspace corresponding to the current working directory (or a parent of), if there
is one.

Parameters ~
{workspaces} obsidian.workspace.WorkspaceSpec[]

Return ~
obsidian.Workspace| `(optional)`

------------------------------------------------------------------------------
                                    *obsidian.Workspace.get_default_workspace()*
                `Workspace.get_default_workspace`({workspaces})
Returns the default workspace.

Parameters ~
{workspaces} obsidian.workspace.WorkspaceSpec[]

Return ~
`(obsidian.Workspace|nil)`

------------------------------------------------------------------------------
                                            *obsidian.Workspace.get_from_opts()*
                       `Workspace.get_from_opts`({opts})
Resolves current workspace from the client config.

Parameters ~
{opts} obsidian.config.ClientOpts

Return ~
obsidian.Workspace| `(optional)`

------------------------------------------------------------------------------
                                                         *obsidian.cached_get()*
                      `cached_get`({path}, {k}, {factory})
Parameters ~
{path} `(table)`
{k} `(string)`
{factory} `(fun(obsidian.Path): any)`

------------------------------------------------------------------------------
                                                                 *obsidian.Path*
                                     `Path`
A `Path` class that provides a subset of the functionality of the Python `pathlib` library while
staying true to its API. It improves on a number of bugs in `plenary.path`.

Class ~
{obsidian.Path} : obsidian.ABC

Fields ~
{filename} `(string)` The underlying filename as a string.
{name} `(string|?)` The final path component, if any.
{suffix} `(string|?)` The final extension of the path, if any.
{suffixes} `(string[])` A list of all of the path's extensions.
{stem} `(string|?)` The final path component, without its suffix.

------------------------------------------------------------------------------
                                                   *obsidian.Path.is_path_obj()*
                           `Path.is_path_obj`({path})
Check if an object is an `obsidian.Path` object.

Parameters ~
{path} `(any)`

Return ~
`(boolean)`

------------------------------------------------------------------------------

Constructors.

------------------------------------------------------------------------------
                                                           *obsidian.Path.new()*
                               `Path.new`({...})
Create a new path from a string.

Parameters ~
{...} `(string|obsidian.Path)`

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                          *obsidian.Path.temp()*
                              `Path.temp`({opts})
Get a temporary path with a unique name.

Parameters ~
{opts} { suffix: `(string|?)` }|?

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                           *obsidian.Path.cwd()*
                                  `Path.cwd`()
Get a path corresponding to the current working directory as given by `vim.loop.cwd()`.

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                        *obsidian.Path.buffer()*
                             `Path.buffer`({bufnr})
Get a path corresponding to a buffer.

Parameters ~
{bufnr} `(integer|?)` The buffer number or `0` / `nil` for the current buffer.

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                       *obsidian.Path.buf_dir()*
                            `Path.buf_dir`({bufnr})
Get a path corresponding to the parent of a buffer.

Parameters ~
{bufnr} `(integer|?)` The buffer number or `0` / `nil` for the current buffer.

Return ~
obsidian.Path

------------------------------------------------------------------------------

Pure path methods.

------------------------------------------------------------------------------
                                                   *obsidian.Path.with_suffix()*
                      `Path.with_suffix`({self}, {suffix})
Return a new path with the suffix changed.

Parameters ~
{suffix} `(string)`

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                   *obsidian.Path.is_absolute()*
                           `Path.is_absolute`({self})
Returns true if the path is already in absolute form.

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                      *obsidian.Path.joinpath()*
                         `Path.joinpath`({self}, {...})
Parameters ~
{...} `(obsidian.Path|string)`
Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                   *obsidian.Path.relative_to()*
                      `Path.relative_to`({self}, {other})
Try to resolve a version of the path relative to the other.
An error is raised when it's not possible.

Parameters ~
{other} `(obsidian.Path|string)`

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                        *obsidian.Path.parent()*
                             `Path.parent`({self})
The logical parent of the path.

Return ~
obsidian.Path| `(optional)`

------------------------------------------------------------------------------
                                                       *obsidian.Path.parents()*
                             `Path.parents`({self})
Get a list of the parent directories.

Return ~
obsidian.Path[]

------------------------------------------------------------------------------
                                                  *obsidian.Path.is_parent_of()*
                      `Path.is_parent_of`({self}, {other})
Check if the path is a parent of other. This is a pure path method, so it only checks by
comparing strings. Therefore in practice you probably want to `:resolve()` each path before
using this.

Parameters ~
{other} `(obsidian.Path|string)`

Return ~
`(boolean)`

------------------------------------------------------------------------------

Concrete path methods.

------------------------------------------------------------------------------
                                                       *obsidian.Path.resolve()*
                         `Path.resolve`({self}, {opts})
Make the path absolute, resolving any symlinks.
If `strict` is true and the path doesn't exist, an error is raised.

Parameters ~
{opts} { strict: `(boolean)` }|?

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                          *obsidian.Path.stat()*
                              `Path.stat`({self})
Get OS stat results.

Return ~
`(table|)` `(optional)`

------------------------------------------------------------------------------
                                                        *obsidian.Path.exists()*
                             `Path.exists`({self})
Check if the path points to an existing file or directory.

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                       *obsidian.Path.is_file()*
                             `Path.is_file`({self})
Check if the path points to an existing file.

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                        *obsidian.Path.is_dir()*
                             `Path.is_dir`({self})
Check if the path points to an existing directory.

Return ~
`(boolean)`

------------------------------------------------------------------------------
                                                         *obsidian.Path.mkdir()*
                          `Path.mkdir`({self}, {opts})
Create a new directory at the given path.

Parameters ~
{opts} { mode: `(integer|?,)` parents: boolean|?, exist_ok: boolean|? }|?

------------------------------------------------------------------------------
                                                         *obsidian.Path.rmdir()*
                              `Path.rmdir`({self})
Remove the corresponding directory. This directory must be empty.

------------------------------------------------------------------------------
                                                        *obsidian.Path.rmtree()*
                             `Path.rmtree`({self})
Recursively remove an entire directory and its contents.

------------------------------------------------------------------------------
                                                         *obsidian.Path.touch()*
                          `Path.touch`({self}, {opts})
Create a file at this given path.

Parameters ~
{opts} { mode: `(integer|?,)` exist_ok: boolean|? }|?

------------------------------------------------------------------------------
                                                        *obsidian.Path.rename()*
                        `Path.rename`({self}, {target})
Rename this file or directory to the given target.

Parameters ~
{target} `(obsidian.Path|string)`

Return ~
obsidian.Path

------------------------------------------------------------------------------
                                                        *obsidian.Path.unlink()*
                         `Path.unlink`({self}, {opts})
Remove the file.

Parameters ~
{opts} { missing_ok: `(boolean|?)` }|?

 vim:tw=78:ts=8:noet:ft=help:norl: