{"action":"created","issue":{"url":"https://api.github.com/repos/jneen/rouge/issues/488","repository_url":"https://api.github.com/repos/jneen/rouge","labels_url":"https://api.github.com/repos/jneen/rouge/issues/488/labels{/name}","comments_url":"https://api.github.com/repos/jneen/rouge/issues/488/comments","events_url":"https://api.github.com/repos/jneen/rouge/issues/488/events","html_url":"https://github.com/jneen/rouge/issues/488","id":159030231,"number":488,"title":"Problems implementing Rouge in a fresh Rails 5 install","user":{"login":"marcamillion","id":137772,"avatar_url":"https://avatars.githubusercontent.com/u/137772?v=3","gravatar_id":"","url":"https://api.github.com/users/marcamillion","html_url":"https://github.com/marcamillion","followers_url":"https://api.github.com/users/marcamillion/followers","following_url":"https://api.github.com/users/marcamillion/following{/other_user}","gists_url":"https://api.github.com/users/marcamillion/gists{/gist_id}","starred_url":"https://api.github.com/users/marcamillion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcamillion/subscriptions","organizations_url":"https://api.github.com/users/marcamillion/orgs","repos_url":"https://api.github.com/users/marcamillion/repos","events_url":"https://api.github.com/users/marcamillion/events{/privacy}","received_events_url":"https://api.github.com/users/marcamillion/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-07T21:34:45Z","updated_at":"2016-06-08T18:33:34Z","closed_at":null,"body":"Not sure if this is related to Rails 5, but this is what I am facing. I have never used Rouge before, but I have used Pygments.rb.\r\n\r\nThis is what I have done.\r\n\r\nGemfile:\r\n\r\n    gem 'rouge'\r\n    gem 'redcarpet'\r\n\r\nThen I created a `config/initializer/rouge.rb`:\r\n\r\n    require 'rouge/plugins/redcarpet'\r\n\r\nThen I created a file called `app/assets/stylesheets/rouge.css.erb`\r\n\r\n    <%= Rouge::Themes::Github.render(:scope => '.highlight') %>\r\n\r\nThen in my `app/helpers/application_helper.rb`, I added this:\r\n\r\n    module ApplicationHelper\r\n      class HTML < Redcarpet::Render::HTML\r\n        include Rouge::Plugins::Redcarpet\r\n    \r\n        def block_code(code, language)\r\n          Rouge.highlight(code, language || 'text', 'html')\r\n        end\r\n      end\r\n    \r\n      def markdown(text)\r\n        render_options = {\r\n          filter_html: true,\r\n          hard_wrap: true,\r\n          link_attributes: { rel: 'nofollow' }\r\n        }\r\n        renderer = HTML.new(render_options)\r\n    \r\n        extensions = {\r\n          autolink: true,\r\n          fenced_code_blocks: true,\r\n          lax_spacing: true,\r\n          no_intra_emphasis: true,\r\n          strikethrough: true,\r\n          superscript: true\r\n        }\r\n        Redcarpet::Markdown.new(renderer, extensions).render(text).html_safe\r\n      end\r\n    end\r\n\r\nThen in my `show.html.erb`, I did this:\r\n\r\n    <%= markdown(@question.body) %>\r\n\r\nBut that literally does not work. It outputs my `ruby` code snippet like this:\r\n\r\n<img width=\"766\" alt=\"unformatted-ruby-snippet\" src=\"https://cloud.githubusercontent.com/assets/137772/15875428/70c78bd2-2ccd-11e6-9d30-6c8dfec1e45f.png\">\r\n\r\nHow do I get this snippet of code to be formatted like Github? Or even just the first step being to be formatted any at all, then how do I tweak the formatting?\r\n\r\nOr even when I do this:\r\n\r\n                <div class=\"highlight\">\r\n                  <%= @question.test_suite %>\r\n                </div>\r\n\r\nIt renders like this:\r\n\r\n<img width=\"798\" alt=\"unformatted-ruby-snippet-2\" src=\"https://cloud.githubusercontent.com/assets/137772/15875453/86869346-2ccd-11e6-91de-2a6a8019d6ba.png\">\r\n\r\nNot quite sure about what I am doing wrong.\r\n\r\nIdeas?\r\n\r\nP.S. If you are interested in answering this on SO, [feel free to do so here](http://stackoverflow.com/questions/37668675/how-do-i-implement-rouge-syntax-highlighting-in-rails).\r\n\r\n\r\n  [1]: http://i.stack.imgur.com/nKJd9.png\r\n  [2]: http://i.stack.imgur.com/qQ49F.png"},"comment":{"url":"https://api.github.com/repos/jneen/rouge/issues/comments/224685938","html_url":"https://github.com/jneen/rouge/issues/488#issuecomment-224685938","issue_url":"https://api.github.com/repos/jneen/rouge/issues/488","id":224685938,"user":{"login":"marcamillion","id":137772,"avatar_url":"https://avatars.githubusercontent.com/u/137772?v=3","gravatar_id":"","url":"https://api.github.com/users/marcamillion","html_url":"https://github.com/marcamillion","followers_url":"https://api.github.com/users/marcamillion/followers","following_url":"https://api.github.com/users/marcamillion/following{/other_user}","gists_url":"https://api.github.com/users/marcamillion/gists{/gist_id}","starred_url":"https://api.github.com/users/marcamillion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcamillion/subscriptions","organizations_url":"https://api.github.com/users/marcamillion/orgs","repos_url":"https://api.github.com/users/marcamillion/repos","events_url":"https://api.github.com/users/marcamillion/events{/privacy}","received_events_url":"https://api.github.com/users/marcamillion/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T18:33:33Z","updated_at":"2016-06-08T18:33:33Z","body":"I am not sure to be honest.\n\nHow do I test that manually?\n\nI have been struggling with figuring out how to ensure it is doing that, to\nbe honest.\n\nWhat's wrong in my code or what can I change to check?\n\nOn Wednesday, June 8, 2016, Jeanine Adkisson <notifications@github.com>\nwrote:\n\n> Hm, interesting - it doesn't seem to be lexing it at all. Are you sure\n> it's using the 'ruby' language and not defaulting it to 'text'?\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/jneen/rouge/issues/488#issuecomment-224653300>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe/AAIaLNyZrRkscciQdHv-voWQL7tbp1Q7ks5qJvIxgaJpZM4IwYmj>\n> .\n>\n\n\n-- \nMarc Gayle\nwww.marcgayle.com\nwww.twitter.com/marcgayle\n"}}
{"actor":{"display_login":"marcamillion"}}