Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiandedeyne/yaml_front_matter
Parse a file or string containing front matter and a document body
https://github.com/sebastiandedeyne/yaml_front_matter
Last synced: 5 days ago
JSON representation
Parse a file or string containing front matter and a document body
- Host: GitHub
- URL: https://github.com/sebastiandedeyne/yaml_front_matter
- Owner: sebastiandedeyne
- License: mit
- Created: 2017-01-04T07:26:44.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-26T14:32:42.000Z (about 4 years ago)
- Last Synced: 2024-11-01T10:42:37.547Z (12 days ago)
- Language: Elixir
- Homepage: https://hex.pm/packages/yaml_front_matter
- Size: 14.6 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# YamlFrontMatter
[![Hex.pm](https://img.shields.io/hexpm/v/yaml_front_matter.svg)](https://hex.pm/packages/yaml_front_matter)
[![Hex.pm](https://img.shields.io/hexpm/dt/yaml_front_matter.svg)](https://hex.pm/packages/yaml_front_matter)
[![Travis](https://img.shields.io/travis/sebastiandedeyne/yaml_front_matter.svg)](https://travis-ci.org/sebastiandedeyne/yaml_front_matter)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`:```md
---
title: Hello
---
Hello, world
```After parsing the document, front matter is returned as a map, and the body as
a string.```elixir
YamlFrontMatter.parse_file "hello_world.md"
{:ok, %{"title" => "Hello"}, "Hello, world"}
```## Installation
Add `yaml_front_matter` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:yaml_front_matter, "~> 1.0.0"}]
end
```Ensure `yaml_front_matter` is started before your application:
```elixir
def application do
[applications: [:yaml_front_matter]]
end
```## Usage
See [https://hexdocs.pm/yaml_front_matter/](https://hexdocs.pm/yaml_front_matter/)
## Changelog
Please see [CHANGELOG](https://github.com/sebastiandedeyne/yaml_front_matter/blob/master/CHANGELOG.md) for more information what has changed recently.
## Testing
```bash
$ mix test
```## Contributing
Pull requests are welcome!
## Credits
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please check the [LICENSE](https://github.com/sebastiandedeyne/yaml_front_matter/blob/master/LICENSE.md) for more information.