README.md in decant-0.1.0 vs README.md in decant-0.2.0
- old
+ new
@@ -20,13 +20,12 @@
Page = Decant.define(dir: '_pages', ext: 'md') do
# Declare frontmatter convenience readers.
frontmatter :title
# Add custom methods - it's a standard Ruby class.
- def html
- # Decant doesn't know about Markdown etc so you should bring your own.
- Kramdown::Document.new(content).to_html
+ def shouty
+ "#{title.upcase}!!!"
end
end
```
Given a file `_pages/about.md` with the following contents:
@@ -43,13 +42,13 @@
You can fetch a `Page` instance by `.find`ing it by its extension-less path within the directory.
```ruby
about = Page.find('about')
-about.content # => "About\n\nMore words.\n"
+about.content # => "# About\n\nMore words.\n"
about.frontmatter # => {:title=>"About", :stuff=>"nonsense"}
-about.html # => "<h1 id=\"about\">About</h1>\n\n<p>More words.</p>\n"
about.title # => "About"
+about.shouty # => "ABOUT!!!"
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/benpickles/decant. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/benpickles/decant/blob/main/CODE_OF_CONDUCT.md).