pub struct Document {
pub blocks: Vec<Block>,
pub block_meta: Vec<BlockMeta>,
pub slot_only: bool,
}Expand description
A parsed markdown document body.
Wraps Vec<Block> with document-level flags. The frontmatter sits in
crate::frontmatter::ParsedDocument; this struct is body-only.
Higher-level code combines the two as needed.
Fields§
§blocks: Vec<Block>Body content as a flat list of block-level nodes.
block_meta: Vec<BlockMeta>Parallel-to-blocks metadata. Invariant: block_meta.len() == blocks.len(). The renderer asserts this in debug builds and
gracefully degrades (treats missing entries as BlockMeta::default())
in release builds.
Defaults to an all-BlockMeta::default() vec sized to match
blocks when constructed via Document::from_blocks; only the
parser populates source_line (under
crate::ast::ParseConfig::emit_source_lines).
slot_only: boolTrue if this document is a slot file (e.g. footer.md) — its
content fills a layout slot rather than being rendered as an
article. The renderer suppresses auto-injected article chrome
(<h1 class="moss-article-title">) when this is set.
Replaces the heading: false YAML synthesis hack at
src-tauri/src/build/footer.rs:160. Lands in Phase A.5 of the
typed-AST migration; in Phase A it’s available but not yet
consumed by src-tauri.
Implementations§
Source§impl Document
impl Document
Sourcepub fn from_blocks(blocks: Vec<Block>) -> Self
pub fn from_blocks(blocks: Vec<Block>) -> Self
Construct a document from a list of blocks. All block_meta entries
are default (no source-line tracking). Use
Document::from_blocks_with_meta when meta is known.
Sourcepub fn from_blocks_with_meta(
blocks: Vec<Block>,
block_meta: Vec<BlockMeta>,
) -> Self
pub fn from_blocks_with_meta( blocks: Vec<Block>, block_meta: Vec<BlockMeta>, ) -> Self
Construct a document from blocks + parallel meta. Panics in debug if the two slices have different lengths.
Sourcepub fn has_shortcode(&self, kind: ShortcodeKind) -> bool
pub fn has_shortcode(&self, kind: ShortcodeKind) -> bool
True if any top-level block is a shortcode of the given kind.
Shallow check: does NOT descend into nested blocks (e.g. a
:::subscribe inside a :::grid cell would not be found by this
query alone). Phase A models the shallow case; deeper
has_shortcode_recursive lands when nested-shortcode AST queries
are first needed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
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>,
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.