pub struct Log {
pub frontmatter: Frontmatter,
pub title: Option<String>,
pub days: Vec<LogDay>,
}Expand description
A parsed log.md.
Fields§
§frontmatter: FrontmatterOptional frontmatter block.
title: Option<String>The top-level # heading text, if any.
days: Vec<LogDay>Date-grouped entries, in document order (the convention is newest-first).
Implementations§
Source§impl Log
impl Log
Sourcepub fn to_markdown(&self) -> String
pub fn to_markdown(&self) -> String
Renders the log back to markdown.
Sourcepub fn append_entry(&mut self, date: &str, kind: Option<&str>, text: &str)
pub fn append_entry(&mut self, date: &str, kind: Option<&str>, text: &str)
Appends a new entry under the given date heading.
If the top (most recent) date heading matches date, the entry is appended
to it. Otherwise, a new date section is inserted at the top of the log.
Sourcepub fn invalid_dates(&self) -> Vec<&str>
pub fn invalid_dates(&self) -> Vec<&str>
Returns the date headings that are not valid ISO-8601 YYYY-MM-DD
(the spec requires this form).
Sourcepub fn structural_errors(&self, text: &str) -> Vec<String>
pub fn structural_errors(&self, text: &str) -> Vec<String>
Returns structural log violations found in the source text.
Log::parse intentionally remains a forgiving reader for consumers
that want to recover entries from imperfect Markdown. Conformance
validation uses this stricter pass to ensure that ignored content is
not mistaken for a valid log.