1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
//! 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: //! //! ```md //! root: //! child1: true //! child2: two //! --- //! //! # Example //! //! This is an example Markdown file. //! ``` //! //! ... and the following code: //! //! ```rust //! use extract_frontmatter::Extractor; //! //! # let input = include_str!("../resources/docs/example.md"); //! let mut extractor = Extractor::new(input); //! extractor.select_by_terminator("---"); //! //! let output: String = extractor.extract(); //! # assert_eq!(output, include_str!("../resources/docs/example.yml").trim()); //! ``` //! //! ... the variable `output` will contain: //! //! ```yml //! root: //! child1: true //! child2: two //! ``` pub use extractor::Extractor; mod extractor; mod modifier; mod selector;