I just re-read the code, and realized you'll probably want to load the file into a variable before running RDiscount on it. Otherwise you'll be trying to parse an HTML file instead of the original markdown file.
get '/:article' do
markdown = File.open("contents/" + params["article"].gsub("-", "_").concat(".md")).read )
@frontmatter = YAML.load(markdown)
@title = @frontmatter['title']
@excerpt = @frontmatter['excerpt']
@content = RDiscount.new(markdown).to_html
end
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is perfect. Thanks Ryan!
I just re-read the code, and realized you'll probably want to load the file into a variable before running RDiscount on it. Otherwise you'll be trying to parse an HTML file instead of the original markdown file.