Skip to main content

parse

Function parse 

Source
pub fn parse(input: &str, options: &Options<'_>) -> Result<ParseResult, Error>
Expand description

Parse AsciiDoc content from a string.

This function parses the provided string as AsciiDoc.

§Example

use acdc_parser::{Options, SafeMode, parse};

let options = Options::builder()
    .with_safe_mode(SafeMode::Unsafe)
    .build()?;
let content = "= Document Title\n\nThis is a paragraph.\n\n== Section Title\n\nThis is a subsection.";
let document = parse(content, &options)?;

§Errors

Returns an error if preprocessing fails or the document cannot be parsed. Recoverable problems appear in the result’s warnings.