pub fn extract_raw_frontmatter(content: &str) -> Result<(&str, &str), Error>Expand description
Extracts raw frontmatter from the content, detecting YAML, TOML, or JSON formats.
This function tries to extract frontmatter based on the common delimiters for
YAML (---), TOML (+++), and JSON ({}). If frontmatter is detected, it
returns the extracted frontmatter and the remaining content.
§Arguments
content- The full content string that may contain frontmatter.
§Returns
A Result containing a tuple of two &str slices: the raw frontmatter and the remaining content.
If no valid frontmatter format is found, it returns Error::InvalidFormat.
§Errors
Error::InvalidFormat: When the frontmatter format is not recognized.Error::ExtractionError: When there is an issue extracting frontmatter.
§Example
use frontmatter_gen::extractor::{extract_delimited_frontmatter, extract_raw_frontmatter, extract_json_frontmatter};
let content = "---\ntitle: Example\n---\nContent here";
let result = extract_raw_frontmatter(content).unwrap();
assert_eq!(result.0, "title: Example");
assert_eq!(result.1, "Content here");