Expand description
Markdown parsing, frontmatter extraction, and content utilities.
This crate provides generic content processing utilities used by all Fabryk domains. It has no domain-specific logic — each domain defines its own metadata types and uses these utilities for parsing.
§Modules
markdown: Markdown parsing and frontmatter extractionmarkdown::frontmatter: YAML frontmatter extractionmarkdown::parser: Heading, paragraph, text extractionmarkdown::helpers: List and section extraction
§Design Philosophy
Generic utilities, domain-specific types. This crate provides:
- YAML frontmatter extraction → returns
yaml_serde::Value - Markdown structure parsing → returns strings and enums
- Content helpers → returns strings and lists
Domain crates (music-theory, math, etc.) define their own structs and deserialize from the generic types.
§Example
use fabryk_content::markdown::{extract_frontmatter, FrontmatterResult};
use serde::Deserialize;
// Your domain-specific frontmatter
#[derive(Deserialize)]
struct MyMeta {
title: String,
category: Option<String>,
}
let content = "---\ntitle: Hello\n---\n\nBody";
let result = extract_frontmatter(content).unwrap();
let meta: Option<MyMeta> = result.deserialize().unwrap();
assert_eq!(meta.unwrap().title, "Hello");Re-exports§
pub use markdown::FrontmatterResult;pub use markdown::extract_all_list_items;pub use markdown::extract_first_heading;pub use markdown::extract_first_paragraph;pub use markdown::extract_frontmatter;pub use markdown::extract_list_from_section;pub use markdown::extract_section_content;pub use markdown::extract_text_content;pub use markdown::normalize_id;pub use markdown::parse_comma_list;pub use markdown::parse_keyword_list;pub use markdown::strip_frontmatter;
Modules§
- markdown
- Markdown parsing and frontmatter extraction utilities.