pub fn parse_file<P: AsRef<Path>>(
file_path: P,
options: &Options<'_>,
) -> Result<ParseResult, Error>Expand description
Parse AsciiDoc content from a file.
This function reads the content from the provided file and parses it as AsciiDoc.
The default SafeMode::Secure turns include directives into links without
reading their targets. In lower modes, Options::include_loader controls
include reads. Neither setting prevents reading the entry file.
§Example
use std::path::Path;
use acdc_parser::{Options, SafeMode, parse_file};
let options = Options::builder()
.with_safe_mode(SafeMode::Unsafe)
.build()?;
let file_path = Path::new("document.adoc");
let document = parse_file(file_path, &options)?;§Errors
Returns an error if the file cannot be read or decoded, preprocessing fails, or the document cannot be parsed. Recoverable problems appear in the result’s warnings.