I've just installed redcarpet gem markdown and all is working fine except, the code block, its not working properly.
```@font-face {</div><div> font-family: 'Glyphicons Halflings';</div><div> src: font- url('glyphicons-halflings-regular.eot');</div><div> src: font-url('glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), font-url('glyphicons-halflings-regular.woff') format('woff'), font-url('glyphicons-halflings-regular.ttf') format('truetype'), font-url('glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');</div><div>}```
As you see its adding html as raw text inside the code block, so If I write:
```my code here
another code```
It will outout:
```my code here<br>another code```
Any suggestions how to fix this??
In my application_helper.rb I have:
def markdown(text)
options = {
filter_html: false,
hard_wrap: true,
link_attributes: { rel: 'nofollow', target: "_blank" },
space_after_headers: true,
fenced_code_blocks: true
}
extensions = {
autolink: true,
no_intra_emphasis: true,
superscript: true,
highlight: true,
strikethrough: true,
quote: true,
no_images: true,
no_styles: true,
prettify: true,
superscript: true,
footnotes: true,
tables: true
}
renderer = Redcarpet::Render::HTML.new(options)
markdown = Redcarpet::Markdown.new(renderer, extensions)
markdown.render(text).html_safe
end
And in my view.html.erb I have:
<p class="body">
<%= markdown(@post.body).html_safe %>
</p>
git commit -m "fix fonts"
git push origin master
git push heroku master``` And it should be: ``` git add . git commit -"fix font" git pu..etc``` It add plain text rather than html! – Sergio Mironescu Iancu Dec 20 '14 at 21:35
@test = "code"
end``` So it add "html code inside when hitting enter of anything else and renders it as plain text" It supposed to add new lines and not show "br" tag, same does when I press "space", it add a: "nbsp;" html text and renders it as plan text.. – Sergio Mironescu Iancu Dec 21 '14 at 15:55
– Sergio Mironescu Iancu Dec 21 '14 at 16:04