Module parse

Module parse 

Source
Expand description

§Parsing Module

Parsing functionality for markdown documents with YAML frontmatter.

§Overview

The parse module provides the ParsedDocument::from_markdown function for parsing markdown documents

§Key Types

  • ParsedDocument: Container for parsed frontmatter fields and body content
  • BODY_FIELD: Constant for the field name storing document body

§Examples

§Basic Parsing

use quillmark_core::ParsedDocument;

let markdown = r#"---
title: My Document
author: John Doe
---


Document content here.
"#;

let doc = ParsedDocument::from_markdown(markdown).unwrap();
let title = doc.get_field("title")
    .and_then(|v| v.as_str())
    .unwrap_or("Untitled");

§Error Handling

The ParsedDocument::from_markdown function returns errors for:

  • Malformed YAML syntax
  • Unclosed frontmatter blocks
  • Multiple global frontmatter blocks
  • Both QUILL and SCOPE specified in the same block
  • Reserved field name usage
  • Name collisions

See PARSE.md for comprehensive documentation of the Extended YAML Metadata Standard.

Structs§

ParsedDocument
A parsed markdown document with frontmatter

Constants§

BODY_FIELD
The field name used to store the document body
QUILL_TAG
Reserved tag name for quill specification