I have a Rails 4 app, and I would like to have a "changes" page that displays the changes introduced in recent versions. I already have this information in a file `CHANGELOG.md` in the root of my project directory. It would be very convenient if I could have a `changes.html.erb` view that converts `CHANGELOG.md` to HTML.

```
-rw-r--r-- 1 ubuntu ubuntu 3640 Apr 24 22:50 CHANGELOG.md
-rw-r--r-- 1 ubuntu ubuntu 1180 Apr 30 13:58 Gemfile
-rw-r--r-- 1 ubuntu ubuntu 6324 Apr 30 13:58 Gemfile.lock
-rw-r--r-- 1 ubuntu ubuntu  155 Mar 10 14:47 README.md
-rw-r--r-- 1 ubuntu ubuntu  249 Mar 10 14:47 Rakefile
drwxr-xr-x 8 ubuntu ubuntu 4096 Mar 10 14:47 app/
drwxr-xr-x 2 ubuntu ubuntu 4096 Mar 10 14:47 bin/
drwxr-xr-x 5 ubuntu ubuntu 4096 Apr 24 22:50 config/
-rw-r--r-- 1 ubuntu ubuntu  153 Mar 10 14:47 config.ru
drwxr-xr-x 3 ubuntu ubuntu 4096 Mar 31 02:38 db/
drwxr-xr-x 4 ubuntu ubuntu 4096 Mar 10 14:47 lib/
drwxr-xr-x 2 ubuntu ubuntu 4096 Mar 14 13:53 log/
drwxr-xr-x 2 ubuntu ubuntu 4096 Mar 14 14:01 public/
drwxr-xr-x 2 ubuntu ubuntu 4096 Apr 26 22:44 spring/
drwxr-xr-x 8 ubuntu ubuntu 4096 Mar 29 02:58 test/
drwxr-xr-x 6 ubuntu ubuntu 4096 Mar 11 23:20 tmp/
drwxr-xr-x 3 ubuntu ubuntu 4096 Mar 10 14:47 vendor/

```

I was able to follow [this example](https://richonrails.com/articles/rendering-markdown-with-redcarpet) to create a helper method to convert Markdown to HTML using [Redcarpet](https://github.com/vmg/redcarpet):

**application\_helper.rb**

```
require 'redcarpet'

module ApplicationHelper
  # Convert markdown to HTML
  def markdown(text)
    options = {
      filter_html:     true,
      hard_wrap:       true, 
      link_attributes: { rel: 'nofollow', target: "_blank" },
      space_after_headers: true, 
      fenced_code_blocks: true
    }

    extensions = {
      autolink:           true,
      superscript:        true,
      disable_indented_code_blocks: true
    }

    renderer    = Redcarpet::Render::HTML.new(options)
    @markdown ||= Redcarpet::Markdown.new(renderer, extensions)
    @markdown.render(text).html_safe
  end    
end

```

I then created a view and action in my static pages controller `pages#changes`.

**changes.html.erb**

```
<h1 class="page-header">Recent Changes</h1>

<div class="row">
  <p>
    <%= markdown("We should be able to render `code` and **bold words** with [Markdown](https://daringfireball.net/projects/markdown)") %>
  </p>
</div>

```

This works, but I am not sure how I would instead pass `CHANGELOG.md` to the `markdown` method. It would be nice if I could leave `CHANGELOG.md` in the top level directory, but I suppose I could move it if it would allow me to access it from a view.