front_matter
Version, currently 0.1.02 versions
- 0.1.1latestAug 3, 2018
- 0.1.0not indexedSep 1, 2021
github.com/chris-huxtable/front_matter.cr
Separates a files front matter from its content
15 stars
1 dependent
License: ISC
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
front_matter:
github: chris-huxtable/front_matter.cr
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# front_matter.cr
[](https://chris-huxtable.github.io/front_matter.cr/)
[](https://github.com/chris-huxtable/front_matter.cr/releases)
[](https://travis-ci.org/chris-huxtable/front_matter.cr)
Separates a files front matter from its content. Unlike Jekyll and others this implementation is format agnostic.
## Front Matter?
Front matter is metadata you can add to a document. The data is located between a pair of `---` lines at the start of a document. With this parser the format can be any format you would like.
```
---
The front matter
---
The content
```
A more practical and complicated example using YAML front matter with Liquid to generate some HTMLc ould look like below.
```
---
layout: post
title: Blogging Like a Hacker
---
<h1>{{ title }}</h1>
<p>This is the content.</p>
```
One of the most common, but not the only, uses for front matter is to use this with [Liquid](https://shopify.github.io/liquid/) ([crystal implementation](https://github.com/wmoxam/liquid-crystal)), or a similar templating language.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
front_matter:
github: chris-huxtable/front_matter.cr
```
## Usage
```crystal
require "front_matter"
```
To process a file:
```crystal
FrontMatter.open("/path/to/file") { |front_matter, content_io|
# Do something with the front matter and content.
# Parse the front matter as YAML, JSON or something else?
}
```
Alternatively you can parse an `IO` so long as it supports the `#.seek` method
```crystal
File.open(filename, "r") { |fd|
FrontMatter.parse(fd) { |front_matter, content_io|
# Do something with the front matter and content.
# Parse the front matter as YAML, JSON or something else?
}
}
```
## Contributing
1. Fork it ( https://github.com/chris-huxtable/front_matter.cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [Chris Huxtable](https://github.com/chris-huxtable) - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Sep 1, 2021
- Commit
b36184ba2644- Indexed
- not yet
Dependents
Repository
github.com/chris-huxtable/front_matter.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 2