https://github.com/cryptogladi/obsidian-parser
Blazingly fast Obsidian vault parser with graph analysis
https://github.com/cryptogladi/obsidian-parser
graph knowledge-graph obsidian parser vault
Last synced: 5 months ago
JSON representation
Blazingly fast Obsidian vault parser with graph analysis
- Host: GitHub
- URL: https://github.com/cryptogladi/obsidian-parser
- Owner: CryptoGladi
- License: mit
- Created: 2025-07-04T21:26:07.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-12T00:39:01.000Z (12 months ago)
- Last Synced: 2025-07-12T03:03:24.032Z (12 months ago)
- Topics: graph, knowledge-graph, obsidian, parser, vault
- Language: Rust
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# obsidian-parser
[](https://opensource.org/licenses/MIT)
[](https://crates.io/crates/obsidian-parser)
[](https://docs.rs/obsidian-parser)
[](https://www.rust-lang.org)
Blazingly fast Rust library for parsing and analyzing [Obsidian](https://obsidian.md) vaults.
## Features
- โก **High Performance**: Parses 1000+ notes in under 3ms
- ๐ง **Knowledge Graphs**: Built-in integration with [`petgraph`](https://docs.rs/petgraph/latest/petgraph) for advanced analysis
- ๐งฉ **Flexible API**: Supports both in-memory and on-disk note representations
- ๐ **Frontmatter Parsing**: Extract YAML properties with [`serde`](https://docs.rs/serde/latest/serde) compatibility
- ๐ **Link Analysis**: Identify connections between notes
- ๐พ **WebAssembly Support**: Add `obsidian-parser` to your Obsidian plugins
## Quick Start
Add to `Cargo.toml`:
```toml
[dependencies]
obsidian-parser = "0.9"
```
### Basic Usage
* Basic Parsing
```rust
use obsidian_parser::prelude::*;
use serde::Deserialize;
// Parse single file with `HashMap`
let note_hashmap = NoteInMemory::from_file_default("note.md").unwrap();
println!("Content: {}", note_hashmap.content().unwrap());
println!("Properties: {:#?}", note_hashmap.properties().unwrap().unwrap());
println!("Tags: {:?}", note_hashmap.tags().unwrap());
// Parse single file with custom struct
#[derive(Clone, Deserialize)]
struct NoteProperties {
created: String,
tags: Vec,
priority: u8,
}
let note_with_serde: NoteInMemory = NoteInMemory::from_file("note.md").unwrap();
```
* Vault Analysis
```rust
use obsidian_parser::prelude::*;
// Load entire vault
let options = VaultOptions::new("/path/to/vault");
let vault: VaultInMemory = VaultBuilder::new(&options)
.into_iter()
.filter_map(Result::ok)
.build_vault(&options)
.unwrap();
// Check for duplicate note names
if !vault.have_duplicates_notes_by_name() {
eprintln!("Duplicate note names detected!");
}
// Access parsed notes
for note in vault.notes() {
println!("Note: {:?}", note);
}
```
* Graph Analysis (requires [`petgraph`](https://docs.rs/petgraph/latest/petgraph) feature)
```rust
#[cfg(feature = "petgraph")]
{
use obsidian_parser::prelude::*;
use petgraph::dot::{Dot, Config};
let options = VaultOptions::new("/path/to/vault");
let vault: VaultInMemory = VaultBuilder::new(&options)
.into_iter()
.filter_map(Result::ok)
.build_vault(&options)
.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:
```bash
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](https://github.com/CryptoGladi)