0

I have a Rails app which includes Redcarpets to process markdown. However, when I write in my article body, it converts nothing. I want to render it to canvas as a string. My code is

renderer = Redcarpet::Render::HTML.new(hard_wrap: true, filter_html: true)
extensions = {fenced_code_blocks: true, autolink: true, no_intraemphasis: true}
redcarpet = Redcarpet::Markdown.new(renderer, extensions)
self.rendered_body = redcarpet.render self.body

Body:

"##This is a test\r\n<canvas>\r\n* list-1\r\n* list-2"

RenderedBody:

"<h2>This is a test</h2>\n\n<p>* list-1<br>\n* list-2</p>\n"

If I remove the "filter_html" parameter, canvas acts like an HTML5 tag. Canvas is put because of filter_html not existing there.

How can I put html tags as strings?

eayurt
  • 1,169
  • 1
  • 19
  • 42

0 Answers0