- Replace unmaintained yaml-rust with yaml-rust2. @NathanReus
- Support custom delimiters for both open and close. @Jawell
- Incorrect behavior of
pod.is_empty()
. @yuchanns
- Add contributor graph.
- Fix Clippy issues.
- Support non-string keys in YAML.
- Fixed overeager whitespace trimming.
- Smaller footprint. A few dependencies have been removed, and the in-house YAML and TOML engines are now optional.
- Excerpt delimiter is now allowed to be on the same line with excerpt content.
- gray-matter is now more strict with delimiters and whitespace on the same line. Previously, whitespace was allowed both before and after the delimiter. Now, you can only have whitespace after the delimiter.
- gray-matter is also less strict with the first delimiter. It does not allow whitespace at the start of the line, but does so at the end (which it did not previously).
- Fixed a panic that was thrown when two delimiters directly followed eachother.
-
Inputs that correctly start with a front matter delimiter, but which are not closed, are not parsed as all front matter anymore. Consider:
--- field: Value Some text
---
in Markdown can also be used as a horisontal rule, which made starting a document with one - like the example above - impossible using this approach.gray_matter is now strict with regards to the front matter section actually being closed, like:
--- field: Value --- Some text
-
Flatter API structure. You can now get access to most core structs and enums at the crate base. These are
Matter
,ParsedEntity
,ParsedEntityStruct
,Error
andPod
. Engines are also made more accessible, being located directly in theengine
module, likegray_matter::engine::TOML
. -
Changes to
Matter
function names, to avoid repeated names and give a friendlier interface:Matter::matter
->Matter::parse
Matter::matter_struct
->Matter::parse_with_struct
It's also worth noting that these functions now take the
input
parameter as a string slice (&str
) instead of aString
, for flexibility. -
Matter
fieldexcerpt_separator
is now calledexcerpt_delimiter
for consistency. -
ParsedEntity
andParsedEntityStruct
have the added fieldmatter
, that stores the raw front matter content. Theexcerpt
field is now anOption<String>
, that isNone
if no excerpt is found.In
ParsedEntity
, the fielddata
is anOption<Pod>
, that isNone
if no front matter is found.
- More documentation. Most public-facing interface should now be documented.
- More idiomatic parse logic. Should be easier to maintain.