Skip to content
Parse a file or string containing front matter and a document body
Elixir
Branch: master
Clone or download
Latest commit c1a823e Jul 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Upgrade deps; formatter Jul 9, 2019
test Upgrade deps; formatter Jul 9, 2019
.formatter.exs Upgrade deps; formatter Jul 9, 2019
.gitignore First commit Jan 4, 2017
.travis.yml Bump version req Sep 27, 2017
CHANGELOG.md Upgrade deps; formatter Jul 9, 2019
LICENSE.md Mix & license Jan 4, 2017
README.md Update readme Oct 5, 2017
mix.exs Release 1.0.0 Jul 9, 2019

README.md

YamlFrontMatter

Hex.pm Hex.pm Travis

Parse a file or string containing front matter and a document body.

Front matter is a block of yaml wrapped between two lines containing ---. In this example, the front matter contains title: Hello, and the body is Hello, world:

---
title: Hello
---
Hello, world

After parsing the document, front matter is returned as a map, and the body as a string.

YamlFrontMatter.parse_file "hello_world.md"
{:ok, %{"title" => "Hello"}, "Hello, world"}    

Installation

Add yaml_front_matter to your list of dependencies in mix.exs:

def deps do
  [{:yaml_front_matter, "~> 0.3.0"}]
end

Ensure yaml_front_matter is started before your application:

def application do
  [applications: [:yaml_front_matter]]
end

Usage

See https://hexdocs.pm/yaml_front_matter/

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ mix test

Contributing

Pull requests are welcome!

Credits

License

The MIT License (MIT). Please check the LICENSE for more information.

You can’t perform that action at this time.