obsidian-parser
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
petgraphfor advanced analysis - 🧩 Flexible API: Supports both in-memory and on-disk note representations
- 🔍 Frontmatter Parsing: Extract YAML properties with
serdecompatibility - 🌐 Link Analysis: Identify connections between notes
Quick Start
Add to Cargo.toml:
[]
= "0.2"
Basic Usage
- Parsing
use *;
use Deserialize;
// Parse single file with `HashMap`
let note_hashmap = from_file_default.unwrap;
println!;
println!;
// Parse single file with custom struct
let note_with_serde: = from_file.unwrap;
- Vault
use *;
// Open vault (defaults to on-disk representation for efficiency)
let vault = open_default?;
// Check for duplicate note names (critical for graph operations)
if !vault.has_unique_filenames
// Access parsed files
for file in &vault.files
Graph Analysis (requires petgraph feature)
Enable in Cargo.toml:
= { = "0.2", = ["petgraph"] }
# obsidian-parser = { version = "0.2", features = ["petgraph", "rayon"] } is fast
Then:
use *;
use ;
let vault = open_default?;
let graph = vault.get_digraph;
// Export to Graphviz format
println!;
// Find most connected note
let most_connected = graph.node_indices
.max_by_key
.unwrap;
println!;
Example: Analyze Knowledge Connectivity
Included example analyzer calculates connected components in your Obsidian vault's knowledge graph:
Limitations
⚠️ Critical Requirement for Graph Analysis:
All note filenames must be unique. Use vault.has_unique_filenames() to verify before calling get_digraph() or get_ungraph().
Why? Notes are identified by filename in graph operations. Duplicates will cause incorrect graph construction.
Performance
My PC AMD Ryzen 5 3600X with NVMe SSD
| Operation | Time |
|---|---|
| Vault initialization | 741.92 µs |
| Graph construction | 1.67 ms |
| Peak memory usage | 900 KiB |
License
MIT © CryptoGladi