brewster
brewster

Reputation: 4492

html rendering in ruby

I am attempting to include a markdown file in my HTML.

currently i have

Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(
  File.read(File.join(Dir.pwd, 'README.md'))
)

Which brings in the contents just fine, aside from properly rendering the html.

my source shows:

<h1>Header</h1>

whcih shows the html markup in the browser:

<h1>Header</h1>

I have been playing with this awhile. Looking for answers always ends me up with rails html_safe helper, but i am not using rails. I have tried CGI.unescapeHTML and HTMLEntities. What am i missing here?

Upvotes: 0

Views: 150

Answers (1)

glasz
glasz

Reputation: 2565

you're using the slim template engine?

in the template you should be able to just do

p== my_var

or

p
  | some text with unescaped html: #{{my_var}}

see the docs.

Upvotes: 1

Related Questions