kitmd 0.1.0

A terminal-based markdown and mermaid renderer/viewer using the Kitty graphics protocol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use comrak::{parse_document, Arena, Options, nodes::{AstNode, NodeValue}};

fn main() {
    let content = "This is a test of the **Kitty** graphics protocol.";
    let arena = Arena::new();
    let root = parse_document(&arena, content, &Options::default());
    
    walk_node(root, 0);
}

fn walk_node<'a>(node: &'a AstNode<'a>, indent: usize) {
    let value = &node.data.borrow().value;
    println!("{:indent$}{:?}", "", value, indent = indent);
    for child in node.children() {
        walk_node(child, indent + 2);
    }
}