pub struct SurfDocBuilder { /* private fields */ }Expand description
Fluent builder for constructing SurfDoc documents programmatically.
§Example
use surf_parse::builder::SurfDocBuilder;
use surf_parse::types::CalloutType;
let doc = SurfDocBuilder::new()
.title("My Doc")
.heading(1, "Welcome")
.callout(CalloutType::Info, "Important note")
.build();
assert_eq!(doc.blocks.len(), 2);Implementations§
Source§impl SurfDocBuilder
impl SurfDocBuilder
Set the document author.
Set the document tags.
Sourcepub fn description(self, desc: &str) -> Self
pub fn description(self, desc: &str) -> Self
Set the document description.
Sourcepub fn front_matter(self, fm: FrontMatter) -> Self
pub fn front_matter(self, fm: FrontMatter) -> Self
Set the entire front matter at once.
Sourcepub fn heading(self, level: u8, text: &str) -> Self
pub fn heading(self, level: u8, text: &str) -> Self
Add a markdown heading (syntactic sugar for markdown("## text")).
Sourcepub fn callout(self, callout_type: CalloutType, content: &str) -> Self
pub fn callout(self, callout_type: CalloutType, content: &str) -> Self
Add a callout block.
Sourcepub fn callout_titled(
self,
callout_type: CalloutType,
title: &str,
content: &str,
) -> Self
pub fn callout_titled( self, callout_type: CalloutType, title: &str, content: &str, ) -> Self
Add a callout block with a title.
Sourcepub fn code(self, content: &str, lang: Option<&str>) -> Self
pub fn code(self, content: &str, lang: Option<&str>) -> Self
Add a code block with optional language.
Sourcepub fn code_file(self, content: &str, lang: &str, file: &str) -> Self
pub fn code_file(self, content: &str, lang: &str, file: &str) -> Self
Add a code block with language and file path.
Sourcepub fn data_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
pub fn data_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
Add a data table block.
Sourcepub fn decision(self, status: DecisionStatus, content: &str) -> Self
pub fn decision(self, status: DecisionStatus, content: &str) -> Self
Add a decision block.
Sourcepub fn metric_with_trend(
self,
label: &str,
value: &str,
trend: Trend,
unit: Option<&str>,
) -> Self
pub fn metric_with_trend( self, label: &str, value: &str, trend: Trend, unit: Option<&str>, ) -> Self
Add a metric block with trend and optional unit.
Sourcepub fn figure_with_caption(
self,
src: &str,
caption: &str,
alt: Option<&str>,
) -> Self
pub fn figure_with_caption( self, src: &str, caption: &str, alt: Option<&str>, ) -> Self
Add a figure block with caption and optional alt text.
Sourcepub fn quote_attributed(self, content: &str, attribution: &str) -> Self
pub fn quote_attributed(self, content: &str, attribution: &str) -> Self
Add a quote block with attribution.
Sourcepub fn hero_image(self, src: &str, alt: Option<&str>) -> Self
pub fn hero_image(self, src: &str, alt: Option<&str>) -> Self
Add a hero image block.
Sourcepub fn testimonial(
self,
content: &str,
author: Option<&str>,
role: Option<&str>,
company: Option<&str>,
) -> Self
pub fn testimonial( self, content: &str, author: Option<&str>, role: Option<&str>, company: Option<&str>, ) -> Self
Add a testimonial block.
Sourcepub fn style(self, properties: Vec<StyleProperty>) -> Self
pub fn style(self, properties: Vec<StyleProperty>) -> Self
Add a style block.
Sourcepub fn pricing_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
pub fn pricing_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
Add a pricing table block.
Sourcepub fn site(self, domain: Option<&str>, properties: Vec<StyleProperty>) -> Self
pub fn site(self, domain: Option<&str>, properties: Vec<StyleProperty>) -> Self
Add a site configuration block.
Sourcepub fn page(
self,
route: &str,
layout: Option<&str>,
title: Option<&str>,
content: &str,
) -> Self
pub fn page( self, route: &str, layout: Option<&str>, title: Option<&str>, content: &str, ) -> Self
Add a page block.
Add a navigation block.
Sourcepub fn embed(
self,
src: &str,
embed_type: Option<EmbedType>,
title: Option<&str>,
) -> Self
pub fn embed( self, src: &str, embed_type: Option<EmbedType>, title: Option<&str>, ) -> Self
Add an embed block.
Sourcepub fn form(self, fields: Vec<FormField>, submit_label: Option<&str>) -> Self
pub fn form(self, fields: Vec<FormField>, submit_label: Option<&str>) -> Self
Add a form block.
Sourcepub fn gallery(self, items: Vec<GalleryItem>, columns: Option<u32>) -> Self
pub fn gallery(self, items: Vec<GalleryItem>, columns: Option<u32>) -> Self
Add a gallery block.
Add a footer block.
Sourcepub fn columns(self, columns: Vec<ColumnContent>) -> Self
pub fn columns(self, columns: Vec<ColumnContent>) -> Self
Add a columns block.
Sourcepub fn hero(
self,
headline: Option<&str>,
subtitle: Option<&str>,
badge: Option<&str>,
buttons: Vec<HeroButton>,
) -> Self
pub fn hero( self, headline: Option<&str>, subtitle: Option<&str>, badge: Option<&str>, buttons: Vec<HeroButton>, ) -> Self
Add a hero section block.
Sourcepub fn features(self, cards: Vec<FeatureCard>, cols: Option<u32>) -> Self
pub fn features(self, cards: Vec<FeatureCard>, cols: Option<u32>) -> Self
Add a features card grid block.
Sourcepub fn comparison(
self,
headers: Vec<String>,
rows: Vec<Vec<String>>,
highlight: Option<&str>,
) -> Self
pub fn comparison( self, headers: Vec<String>, rows: Vec<Vec<String>>, highlight: Option<&str>, ) -> Self
Add a comparison table block.
Sourcepub fn before_after(
self,
before_items: Vec<BeforeAfterItem>,
after_items: Vec<BeforeAfterItem>,
transition: Option<&str>,
) -> Self
pub fn before_after( self, before_items: Vec<BeforeAfterItem>, after_items: Vec<BeforeAfterItem>, transition: Option<&str>, ) -> Self
Add a before/after comparison block.
Sourcepub fn pipeline(self, steps: Vec<PipelineStep>) -> Self
pub fn pipeline(self, steps: Vec<PipelineStep>) -> Self
Add a pipeline flow block.
Sourcepub fn section(
self,
bg: Option<&str>,
headline: Option<&str>,
subtitle: Option<&str>,
content: &str,
) -> Self
pub fn section( self, bg: Option<&str>, headline: Option<&str>, subtitle: Option<&str>, content: &str, ) -> Self
Add a section container block.
Sourcepub fn product_card(
self,
title: &str,
subtitle: Option<&str>,
badge: Option<&str>,
badge_color: Option<&str>,
body: &str,
features: Vec<String>,
cta_label: Option<&str>,
cta_href: Option<&str>,
) -> Self
pub fn product_card( self, title: &str, subtitle: Option<&str>, badge: Option<&str>, badge_color: Option<&str>, body: &str, features: Vec<String>, cta_label: Option<&str>, cta_href: Option<&str>, ) -> Self
Add a product card block.
Sourcepub fn app(
self,
name: &str,
binary: Option<&str>,
region: Option<&str>,
port: Option<u32>,
children: Vec<Block>,
) -> Self
pub fn app( self, name: &str, binary: Option<&str>, region: Option<&str>, port: Option<u32>, children: Vec<Block>, ) -> Self
Add an app manifest container block.
Sourcepub fn deploy(
self,
env: &str,
app: Option<&str>,
machines: Option<u32>,
memory: Option<u32>,
) -> Self
pub fn deploy( self, env: &str, app: Option<&str>, machines: Option<u32>, memory: Option<u32>, ) -> Self
Add a deploy block.
Sourcepub fn infra_database(self, name: Option<&str>, shared_auth: bool) -> Self
pub fn infra_database(self, name: Option<&str>, shared_auth: bool) -> Self
Add an infrastructure database block.