Skip to main content

Crate surf_parse

Crate surf_parse 

Source
Expand description

surf-parse — parser for the SurfDoc format.

SurfDoc is a typed document format with block directives, embedded data, and presentation hints. Backward-compatible with Markdown. This crate provides the foundational parser that turns .surf source text into a structured SurfDoc tree.

§Quick start

let result = surf_parse::parse("# Hello\n\n::callout[type=info]\nHi!\n::\n");
assert!(result.diagnostics.is_empty());
assert_eq!(result.doc.blocks.len(), 2);

Re-exports§

pub use blocks::parse_schema_field_type;
pub use blocks::parse_schema_constraint;
pub use builder::SurfDocBuilder;
pub use citation::active_style;
pub use citation::bibliography_heading;
pub use citation::build_context;
pub use citation::format_in_text;
pub use citation::format_reference;
pub use citation::parse_author;
pub use citation::parse_authors;
pub use citation::reference_list;
pub use citation::reference_list_keyed;
pub use citation::Author;
pub use citation::CiteContext;
pub use citation::CiteItem;
pub use citation::CiteRef;
pub use citation::Reference;
pub use citation::RefType;
pub use lint::AppliedFix;
pub use lint::CheckReport;
pub use lint::FixOutcome;
pub use lint::LintConfig;
pub use lint::LintRule;
pub use lint::SkippedFix;
pub use lint::apply_fixes;
pub use lint::apply_fixes_once;
pub use lint::check;
pub use lint::check_with;
pub use parse::parse;
pub use template::TemplateContext;
pub use render_html::PageConfig;
pub use render_html::SiteConfig;
pub use render_html::PageEntry;
pub use render_html::extract_site;
pub use render_html::humanize_route;
pub use render_html::render_site_page;
pub use render_html::render_site_single_file;
pub use render_html::accent_ink_color;
pub use render_html::contrast_ratio;
pub use render_html::to_shell_page;
pub use render_html::HeadIcon;
pub use render_html::HeadScript;
pub use slots::resolve_slot_markers;
pub use slots::IMG_SLOT_PLACEHOLDER_URI;
pub use render_slides::DeckConfig;
pub use render_slides::SlideEntry;
pub use render_slides::extract_deck;
pub use render_slides::render_deck_html;
pub use error::*;
pub use types::*;

Modules§

attrs
blocks
Per-block-type content parsers (Pass 2 resolution).
builder
Programmatic SurfDoc builder and .surf source serializer.
citation
Citation & bibliography engine (CSL-style, deterministic).
error
icons
Built-in SVG icon set for SurfDoc.
inline
Inline extension scanner.
lint
Style lint rules (L-codes) and the unified check entry point.
parse
render_html
HTML fragment renderer.
render_latex
LaTeX renderer.
render_md
Markdown degradation renderer.
render_slides
Presentation deck rendering — Slides as a first-class SurfDoc output type.
render_term
ANSI terminal renderer.
render_typst
Typst markup renderer.
resolve
Shared resolution step — style packs, fonts, and contrast math.
slots
Generation slot markers («FILL: …» / «IMG: …») — render-time resolution.
template
Template variable interpolation for SurfDoc rendering.
types
validate
Schema validation for SurfDoc documents.

Constants§

SURFDOC_CSS
Unified CSS for app chrome and SurfDoc content rendering.