obsidian-parser

Crates.ioobsidian-parser
lib.rsobsidian-parser
version0.4.2
created_at2025-07-06 20:04:58.428209+00
updated_at2025-08-28 21:00:28.735714+00
descriptionBlazingly fast Obsidian vault parser with graph analysis
homepage
repositoryhttps://github.com/CryptoGladi/obsidian-parser
max_upload_size
id1740409
size105,886
(CryptoGladi)

documentation

https://docs.rs/obsidian-parser/latest/obsidian_parser

README

obsidian-parser

License: MIT Crates.io Docs.rs Rust

Blazingly fast Rust library for parsing and analyzing Obsidian vaults.

Features

  • High Performance: Parses 1000+ notes in under 3ms
  • 🧠 Knowledge Graphs: Built-in integration with petgraph for advanced analysis
  • 🧩 Flexible API: Supports both in-memory and on-disk note representations
  • 🔍 Frontmatter Parsing: Extract YAML properties with serde compatibility
  • 🌐 Link Analysis: Identify connections between notes

Quick Start

Add to Cargo.toml:

[dependencies]
obsidian-parser = "0.4"

Basic Usage

  • Parsing
use obsidian_parser::prelude::*;
use serde::Deserialize;

// Parse single file with `HashMap`
let note_hashmap = ObFileInMemory::from_file_default("note.md").unwrap();

println!("Content: {}", note_hashmap.content().unwrap());
println!("Properties: {:#?}", note_hashmap.properties().unwrap().unwrap());

// Parse single file with custom struct
#[derive(Clone, Deserialize)]
struct NoteProperties {
     created: String,
     tags: Vec<String>,
     priority: u8,
 }

let note_with_serde: ObFileInMemory<NoteProperties> = ObFileInMemory::from_file("note.md").unwrap();
  • Vault
use obsidian_parser::prelude::*;

// Load entire vault
let vault = Vault::open_default("/path/to/vault").unwrap();

// Check for duplicate note names
if !vault.check_unique_note_name() {
     eprintln!("Duplicate note names detected!");
}

// Access parsed files
for file in vault.files {
   println!("Note: {:?}", file.path());
}

Graph Analysis (requires petgraph feature)

Enable in Cargo.toml:

obsidian-parser = { version = "0.4", features = ["petgraph"] }
# obsidian-parser = { version = "0.4", features = ["petgraph", "rayon"] } is fast

Then:

use obsidian_parser::prelude::*;
use petgraph::dot::{Dot, Config};

let vault = Vault::open_default("/path/to/vault").unwrap();
let graph = vault.get_digraph().unwrap();
// Export to Graphviz format
println!("{:?}", Dot::with_config(&graph, &[Config::EdgeNoLabel]));

// Find most connected note
let most_connected = graph.node_indices()
    .max_by_key(|n| graph.edges(*n).count())
    .unwrap();
println!("Knowledge hub: {}", graph[most_connected]);

Example: Analyze Knowledge Connectivity

Included example analyzer calculates connected components in your Obsidian vault's knowledge graph:

cargo run --example analyzer --release --features="petgraph rayon" -- --path="Path to Obsidian vault"

Performance

My PC AMD Ryzen 5 3600X with NVMe SSD

Operation Time
Vault initialization 739.35 µs
Graph construction 1.22 ms
Peak memory usage 900 KiB

License

MIT © CryptoGladi

Commit count: 32

cargo fmt