[][src]Crate extract_frontmatter

A library that allows a user to extract an arbitrary number of lines of "front-matter" from the start of any multiline string.

Note that absolutely no parsing of extracted front-matter is performed; this is designed to output its results for another library to then parse.

Usage

To use this library:

  1. Instantiate an instance of Extractor
  2. Call a selector method on it
  3. Call zero or more modifier methods on it
  4. Call extract() on it

Example

Given a variable input with the following text:

root:
  child1: true
  child2: two
---

# Example

This is an example Markdown file.

... and the following code:

use extract_frontmatter::Extractor;

let mut extractor = Extractor::new(input);
extractor.select_by_terminator("---");

let output: String = extractor.extract();

... the variable output will contain:

root:
  child1: true
  child2: two

Structs

Extractor

Extracts front-matter depending on how it is configured.