4 releases

0.1.0-alpha4 Jul 16, 2020
0.1.0-alpha3 Jul 15, 2020
0.1.0-alpha2 Feb 27, 2019
0.1.0-alpha1 Jan 5, 2019

#659 in Parser implementations

Download history 31/week @ 2022-06-11 44/week @ 2022-06-18 37/week @ 2022-06-25 46/week @ 2022-07-02 42/week @ 2022-07-09 57/week @ 2022-07-16 38/week @ 2022-07-23 71/week @ 2022-07-30 60/week @ 2022-08-06 55/week @ 2022-08-13 56/week @ 2022-08-20 56/week @ 2022-08-27 140/week @ 2022-09-03 55/week @ 2022-09-10 39/week @ 2022-09-17 51/week @ 2022-09-24

292 downloads per month
Used in 4 crates

BSD-3-Clause

6KB
104 lines

Matter

CI Status Badge Crates.io Downloads Badge License Made by Fader

A universal frontmatter parser and extractor, written in Rust.

Installation

By default, matter is installed with support for TOML, YAML, and JSON frontmatter formats. However, you can override the defaults and install support for one specific format like so:

matter = { version = "0.1.0-alpha3", features = ["toml"] }

Usage

Once installed, you'll notice that Matter exports only a handful of functions. This is because it does most of the work for you. It also attempts to operate with minimal overhead, by only allocating as necessary.

let input = std::fs::read_to_string("./path/to/content.md").unwrap();
let Some((matter, content)) = matter::extract(&input).unwrap();

See the docs for more examples.

CLI

Matter is also distributed as a command line application. Install (cargo install matter --version 0.1.0-alpha3) and run to inspect any file's frontmatter:

matter path/to/content.md

License

Copyright 2018 Nicholas Young, All rights reserved. Released under a 3-Clause BSD License.

Dependencies

~1–1.3MB
~38K SLoC