ruhoh / ruhoh.rb

http://ruhoh.com
616 stars 69 forks source link

Footnotes #200

Open ghost opened 11 years ago

ghost commented 11 years ago

I couldn't find an issue regarding this (by using Github repository search), so I assume this is the first time it's coming up.

  1. Is there a way to add footnotes?
  2. Is such a feature available on post.ruhoh.com?
celadevra commented 11 years ago

The default Markdown converter used by Ruhoh is Redcarpet. It supports footnote syntax with an extension, see https://github.com/vmg/redcarpet.

You may want to copy ruhoh.rb/lib/ruhoh/converters/markdown.rb to the plugins/ folder under your blog scaffold and add the extension like this (code not tested):

def self.convert(content)
        require 'redcarpet'
        markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(:with_toc_data => true),
          :autolink => true, 
          :fenced_code_blocks => true, 
>>        :footnotes => true,
        )
        markdown.render(content)
      end

AFAIK post.ruhoh.com is still running ruhoh 1.x and does not support plugins, so I guess you have to self-host Ruhoh to write footnotes.

ghost commented 11 years ago

Thanks!

@plusjade I wonder if there is any plan of offering the footnotes feature (or plugins in general) on post.ruhoh.com.

plusjade commented 11 years ago

@dickfeynman the problem is ruhoh 2+ encourages much more usage of customizing your experience with configuration and native ruby. I'm guessing that mustache is fundamentally unsecure. Therefore, if I host ruhoh 2.0 blogs I would ultimately want to do it via a sandboxed environment so that users can also run plugins as they wish. The problem is I don't know how to do that and it will probably cost a non-trivial amount ... so it's on the backburner for now.

zxaos commented 10 years ago

@plusjade It might be possible to use a jruby-sandbox environment for this (since it looks like that project is runs code in 1.9 mode now).