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

#2039 in Parser implementations

Download history 322/week @ 2024-06-09 373/week @ 2024-06-16 815/week @ 2024-06-23 388/week @ 2024-06-30 223/week @ 2024-07-07 330/week @ 2024-07-14 467/week @ 2024-07-21 897/week @ 2024-07-28 807/week @ 2024-08-04 1030/week @ 2024-08-11 1867/week @ 2024-08-18 2072/week @ 2024-08-25 2455/week @ 2024-09-01 1897/week @ 2024-09-08 1068/week @ 2024-09-15 662/week @ 2024-09-22

6,212 downloads per month
Used in 5 crates

BSD-3-Clause

7KB
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

~2.2–3MB
~54K SLoC