basalt_core/lib.rs
1//! This crate provides the core functionality for Basalt, a TUI application for Obsidian.
2//! It lets you read and manipulate Obsidian's configuration, vaults, and notes.
3//!
4//! # Example
5//!
6//! ```
7//! use basalt_core::obsidian::{ObsidianConfig, Error};
8//!
9//! let config = ObsidianConfig::load();
10//! ```
11//!
12//! This crate also provides a markdown parser that produces a custom AST using the
13//! [`pulldown_cmark::Parser`]. The "AST" acts as an intermediate layer. This enables segregation
14//! of the parsing logic into a module under basalt-core lib.
15//!
16//! # Example
17//!
18//! ```
19//! use basalt_core::markdown::{from_str, Node, HeadingLevel, Text};
20//!
21//! let markdown = "# My Heading\n\nSome text.";
22//! let nodes = from_str(markdown);
23//!
24//! assert_eq!(nodes, vec![
25//! Node::Heading {
26//! level: HeadingLevel::H1,
27//! text: Text::from("My Heading"),
28//! },
29//! Node::Paragraph {
30//! text: Text::from("Some text."),
31//! },
32//! ])
33//! ```
34
35#![deny(missing_docs)]
36#![doc(html_root_url = "https://docs.rs/basalt-core")]
37
38/// Provides Markdown parser that supports Obsidian flavor.
39/// Obsidian flavor is a combination of different flavors and a few differences.
40///
41/// Namely `CommonMark` and `GitHub Flavored Markdown`. More info
42/// [here](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown).
43///
44/// NOTE: Current iteration does not handle Obsidian flavor, unless it is covered by
45/// pulldown-cmark. Part of Obsidian flavor is for example use of any character inside tasks to
46/// mark them as completed `- [?] Completed`.
47///
48/// This crate uses [`pulldown_cmark`] to parse the markdown and enable the applicable features. This
49/// crate uses own intermediate types to provide the parsed markdown nodes.
50pub mod markdown;
51
52/// Provides Obsidian interoperability operations
53pub mod obsidian;