A modern TUI homage to WordStar & WordPerfect for DOS — a real writing tool built on WordStar's touch-typist command language and long-hand-page metaphor.
//! Outline navigation: jump between Markdown headings in the document,
//! browsed with the same searchable-list UI as the command palette.
usecrate::buffer::Buffer;usecrate::markdown;pubstructEntry{publevel:u8,
pubtitle: String,
/// 0-indexed document line the heading is on.
publine:usize,
/// Char index of the heading title, just past the "# " marker.
pubchar_pos:usize,
}/// Every Markdown heading in the document, in document order.
pubfnscan(buf:&Buffer)->Vec<Entry>{letmut out =Vec::new();for line in0..buf.len_lines(){let text = buf.line_text(line);ifletSome((level, title))=markdown::heading_level(&text){let marker_len = level asusize+1;// '#' * level, then a space
out.push(Entry {
level,
title,
line,
char_pos: buf.line_start(line)+ marker_len,});}}
out
}