Crate basalt_core

Source
Expand description

This crate provides the core functionality for Basalt, a TUI application for Obsidian. It lets you read and manipulate Obsidian’s configuration, vaults, and notes.

§Example

use basalt_core::obsidian::{ObsidianConfig, Error};

let config = ObsidianConfig::load();

This crate also provides a markdown parser that produces a custom AST using the pulldown_cmark::Parser. The “AST” acts as an intermediate layer. This enables segregation of the parsing logic into a module under basalt-core lib.

§Example

use basalt_core::markdown::{from_str, Range, Node, MarkdownNode, HeadingLevel, Text};

let markdown = "# My Heading\n\nSome text.";
let nodes = from_str(markdown);

assert_eq!(nodes, vec![
  Node {
    markdown_node: MarkdownNode::Heading {
      level: HeadingLevel::H1,
      text: Text::from("My Heading"),
    },
    source_range: Range { start: 0, end: 13 },
  },
  Node {
    markdown_node: MarkdownNode::Paragraph {
      text: Text::from("Some text."),
    },
    source_range: Range { start: 14, end: 24 },
  },
])

Modules§

markdown
Provides Markdown parser that supports Obsidian flavor. Obsidian flavor is a combination of different flavors and a few differences.
obsidian
Provides Obsidian interoperability operations This module provides functionality operating with Obsidian. It lets you read and manipulate Obsidian’s configuration, vaults, and notes.