[kramdown-users] Using kramdown while reading from a file

Thomas Leitner t_leitner at gmx.at
Tue Jan 22 17:34:16 UTC 2013

On 2013-01-16 14:28 +0530 Sandeep Laxman wrote:
> Hi Guys,
> I have a static file in which data is stored in kramdown syntax. I am
> trying to convert it to HTML using the following code
> In the controller:
> @demo =
> Kramdown::Document.new(File.read("./app/views/books/demo_data")).to_html
> In the view:
> <div class="span6">
> <%= raw @demo %>
> </div>
> However, in the output, all I get is the raw kramdown syntax data in
> the demo_data file with <pre> tags attached. No conversion to HTML is
> taking place. What can I do to fix this?

You are using the `Kramdown::Document` class as it is intended. So you
should try setting a debug point right after assigning to @demo and have
a look at its value (or just use `p @demo`).

-- Thomas

More information about the kramdown-users mailing list