Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. require 'redcarpet'
  2. require 'rails'
  3.  
  4. def markdown(text)
  5. markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
  6. extensions = {
  7. autolink: true,
  8. tables: true,
  9. no_intraemphasis: true,
  10. hard_wrap: true,
  11. filter_html: true
  12. })
  13. raw(markdown.render(text))
  14. end
  15.  
  16. text = '_italic_ and **bold** and `@inline_code` and: \n </code snippet>'
  17.  
  18.  
  19. p markdown(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement