[−][src]Crate extract_frontmatter
A library that allows a user to extract and arbitrary number of lines of "frontmatter" from the start of any multiline string.
Included is some basic auto-detection of what lines are considered to be part of the frontmatter, but erroneous detection can be prevented by tuning the copnfiguration.
Note that absolutely no parsing of extracted frontmatter is performed; this is designed to output its results for another library to then parse.
Example
Given a variable input with the following text:
<!--
parent:
- item1
- item2
-->
# Title
This is an example markdown document.
... and the following code:
use extract_frontmatter::{Config, extract}; let config = Config::new(None, Some("-->"), None, true); let output = extract(&config, input);
... the variable output will contain:
parent:
- item1
- item2
Structs
| Config | The configuration to be used when extracting frontmatter. |
Functions
| extract | Extract frontmatter from the given string using the provided configuration. |