Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a custom markdown renderer with github-markup/gollum and Rails 3
    primarykey
    data
    text
    <p>I'm having what I think is a load ordering issue using github-markup.</p> <p>I'm trying to override the default markdown renderers and use my own custom renderer in a Rails initializer. However it doesn't work; it just seems to ignore my initializer <strong>unless</strong> I specifically include the githum-markup gem in my Gemfile <strong>and</strong> specify add the :git or :path setting. (github-markup is a dependancy for the gollum gem)</p> <p>Gemfile</p> <pre><code>## Github-Markup ####### # Initializer wiki.rb wont work properly unless this gem is loaded via path: or git: gem 'github-markup', :git =&gt; 'git://github.com/github/markup.git' gem 'gollum' #gollum already includes github-markup so I shouldn't need the lines above </code></pre> <p>initializers/wiki.rb</p> <pre><code>GitHub::Markup.add_markup(/md|mkdn?|mdwn|mdown|markdown/) do |content| CustomMarkdown.new(content).to_html end </code></pre> <p>Looking at the github-markup code the class calls the markups near the bottom of this file:</p> <p><a href="https://github.com/github/markup/blob/master/lib/github/markup.rb" rel="nofollow">https://github.com/github/markup/blob/master/lib/github/markup.rb</a></p> <pre><code>instance_eval File.read(File.dirname(__FILE__) + '/markups.rb') </code></pre> <p>And you can see the markdown renderers I'm trying to override at the top of this file:</p> <p><a href="https://github.com/github/markup/blob/master/lib/github/markups.rb" rel="nofollow">https://github.com/github/markup/blob/master/lib/github/markups.rb</a></p> <pre><code>MD_FILES = /md|mkdn?|mdwn|mdown|markdown/ if markup('github/markdown', MD_FILES) do |content| GitHub::Markdown.render(content) end elsif markup(:redcarpet, MD_FILES) do |content| RedcarpetCompat.new(content).to_html end elsif markup(:rdiscount, MD_FILES) do |content| RDiscount.new(content).to_html end elsif markup(:maruku, MD_FILES) do |content| Maruku.new(content).to_html end elsif markup(:kramdown, MD_FILES) do |content| Kramdown::Document.new(content).to_html end elsif markup(:bluecloth, MD_FILES) do |content| BlueCloth.new(content).to_html end end </code></pre> <p>Just to be clear I'm using Ruby 1.9.3 and I'd like to get it so I can just call gem 'gollum' in the Gemfile and use my initializer to override the default github-markup markdown renderer with my own custom renderer.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload