Skip to main content

Note

Struct Note 

Source
pub struct Note {
    pub properties: BTreeMap<String, Value>,
    pub name: String,
    pub basename: String,
    pub path: String,
    pub folder: String,
    pub ext: String,
    pub size: u64,
    pub ctime: Option<BaseDate>,
    pub mtime: Option<BaseDate>,
    pub tags: Vec<String>,
    pub links: Vec<BaseLink>,
    pub slug: String,
}
Expand description

One note (markdown file) in the vault, queryable by a base.

Fields§

§properties: BTreeMap<String, Value>

Frontmatter properties, keyed by name, coerced to typed values. Accessed via note.<name> or a bare <name> in expressions.

§name: String

file.name — filename with extension (e.g. Intro.md).

§basename: String

file.basename — filename without extension.

§path: String

file.path — full vault-relative path (e.g. guide/Intro.md).

§folder: String

file.folder — containing folder path (empty for root).

§ext: String

file.ext — extension without the dot (md).

§size: u64

file.size — byte length of the source file.

§ctime: Option<BaseDate>

file.ctime — creation time, if known.

§mtime: Option<BaseDate>

file.mtime — modification time, if known.

§tags: Vec<String>

file.tags — all #tags (frontmatter + body), without the leading #.

§links: Vec<BaseLink>

file.links — outbound internal link targets.

§slug: String

The doc’s site slug (docgen-specific; used to build the cell hyperlink to the rendered page). Not exposed as a base property.

Implementations§

Source§

impl Note

Source

pub fn file_property(&self, field: &str) -> Value

Resolve a file.<field> access to a value. Unknown fields → Null.

Source

pub fn note_property(&self, name: &str) -> Value

Resolve a bare/note. property. Unknown → Null.

Source

pub fn has_tag(&self, want: &str) -> bool

Whether this note has any of tags (Obsidian’s file.hasTag matches a tag or any of its parents: a note tagged #a/b matches hasTag("a")).

Source

pub fn in_folder(&self, folder: &str) -> bool

Whether this note lives in folder or any subfolder of it.

Whether this note links to target (by basename/path).

Trait Implementations§

Source§

impl Clone for Note

Source§

fn clone(&self) -> Note

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Note

Source§

fn default() -> Note

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnsafeUnpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.