ndg_commonmark/
types.rs

1//! Types for ndg-commonmark public API and internal use.
2use serde::{Deserialize, Serialize};
3
4/// Represents a header in a Markdown document.
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
6pub struct Header {
7    /// Header text (inline content, no markdown formatting).
8    pub text: String,
9    /// Header level (1-6).
10    pub level: u8,
11    /// Generated or explicit anchor ID for the header.
12    pub id: String,
13}
14
15/// Result of Markdown processing.
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
17pub struct MarkdownResult {
18    /// Rendered HTML output.
19    pub html: String,
20
21    /// Extracted headers (for `ToC`, navigation, etc).
22    pub headers: Vec<Header>,
23
24    /// Title of the document, if found (usually first H1).
25    pub title: Option<String>,
26}