pub struct SurfDoc {
pub front_matter: Option<FrontMatter>,
pub blocks: Vec<Block>,
pub source: String,
}Expand description
A parsed SurfDoc document.
Fields§
§front_matter: Option<FrontMatter>Parsed YAML front matter, if present.
blocks: Vec<Block>Ordered sequence of blocks in the document body.
source: StringOriginal source text that was parsed.
Implementations§
Source§impl SurfDoc
impl SurfDoc
Sourcepub fn to_markdown(&self) -> String
pub fn to_markdown(&self) -> String
Render this document as standard CommonMark markdown (no :: markers).
Sourcepub fn to_html(&self) -> String
pub fn to_html(&self) -> String
Render this document as an HTML fragment with surfdoc-* CSS classes.
Sourcepub fn to_html_page(&self, config: &PageConfig) -> String
pub fn to_html_page(&self, config: &PageConfig) -> String
Render this document as a complete HTML page with SurfDoc discovery metadata.
Sourcepub fn to_terminal(&self) -> String
pub fn to_terminal(&self) -> String
Render this document as ANSI-colored terminal text.
Sourcepub fn validate(&self) -> Vec<Diagnostic>
pub fn validate(&self) -> Vec<Diagnostic>
Validate this document and return any diagnostics.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SurfDoc
impl<'de> Deserialize<'de> for SurfDoc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SurfDoc
impl RefUnwindSafe for SurfDoc
impl Send for SurfDoc
impl Sync for SurfDoc
impl Unpin for SurfDoc
impl UnwindSafe for SurfDoc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more