Skip to content

Latest commit

 

History

82 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logseq

Simple library to read/write to Logseq note graphs in Rust, built with comrak.

Usage

First, add the crate to your Cargo.toml:

logseq = { version = "0.1.8", git = "https://codeberg.org/everette/logseq", tag = "v0.1.8" }

Then, use it in your code:

use logseq::prelude::*;

fn main() {
    let graph = Graph::builder().dir("/path/to/your/graph/".into()).build().unwrap();
    let today = graph.today().unwrap();

    let blocks: Vec<&Block> = today.blocks().collect();
    let content = today.document.to_string();

    println!("The file content for today's journal entry:\n---\n{}\n---", content.trim());

    if !blocks.is_empty() {
        println!("Blocks:");
    }

    for block in blocks {
        println!("---\n* ID: {}\n* Content (plain): {}\n---", block.properties.id, block.plain());
    }
}

See the tests for more examples, or read the docs online.

Crate Features

  • regex-lite: use the regex-lite crate as the regular expression backend; otherwise, use regex (enabled by default)
  • serde: enable support for serde serialization & deserialization of certain types
  • icalendar: provides icalendar type conversion for block views

Support

Currently, the latest version of Logseq OG (file-based) is supported, with some caveats:

  • "Timetracking" should be disabled
  • "Preferred workflow" should be TODO/DOING
  • Graph reindexing is currently TODO, so journal entry files created through the library aren't yet visible in Logseq (tracking issue)

Support for the DB version of Logseq is also TODO (tracking issue)

Contributing

Contributions are hugely appreciated! The repository on Codeberg is ideal, but the GitHub mirror works too :>

Releases

Packages

Contributors

Languages