Skip to content

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

License

Notifications You must be signed in to change notification settings

boostingtech/front_matter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FrontMatter

Hex.pm build

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.

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

Installation

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

def deps do
  [{:front_matter, "~> 0.1.0"}]
end

Ensure front_matter is started before your application:

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

Usage

See https://hexdocs.pm/front_matter/

Testing

$ mix test

Contributing

Pull requests are welcome!

Credits

License

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages