Kramdown in Marked

Henry Mercer's Avatar

Henry Mercer

29 Dec, 2011 10:22 PM

I can't get Kramdown to work in Marked. I've set the "Custom Markdown Processor" to "/Library/Ruby/Gems/1.8/gems/kramdown-0.13.4/bin/kramdown" after installing it with the default rubygems and I'm getting no output. The Kramdown command works — tail -b 99999999 /Users/Henry/Documents/hmercer.com/_posts/2011-08-03-a-web-server-with-web-sharing.markdown | /Library/Ruby/Gems/1.8/gems/kramdown-0.13.4/bin/kramdown produces HTML — so I'm confused about why it isn't working.

  1. Support Staff 1 Posted by Brett on 29 Dec, 2011 11:12 PM

    Brett's Avatar

    I did some testing and found that "/Users/ttscoff/.rvm/gems/ruby-1.9.2-p290/bin/kramdown" didn't work for me, but the binary that was installed in /usr/bin did work. Did the gem install a kramdown executable in either /usr/bin/kramdown or /usr/local/bin/kramdown? I'd be curious to know if that location worked better for you. I'll try to track down why the same version works for me in one location and not another, but any testing you could do on the matter would be of great help.

    Thanks!

    -Brett

  2. Support Staff 2 Posted by Brett on 29 Dec, 2011 11:17 PM

    Brett's Avatar

    Also, check Console or tail the system.log and tell me what you get when you have the custom processor set and try to refresh a page. There should be a ruby error there, if my testing is any indication. It looks like there's a mismatch in the ruby version/gemsets when Marked shells out to Ruby on my machine. Curious what yours looks like.

    Also, do you use RVM?

    -Brett

  3. 3 Posted by Mark Quezada on 29 Dec, 2011 11:20 PM

    Mark Quezada's Avatar

    I was having this issue as well. Open the console.app (in Utilities folder) and check the log called "All Messages."

    I had this in there:

    12/29/11 1:02:35.430 PM [0x0-0x538538].com.brettterpstra.marky: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem kramdown (>= 0) (Gem::LoadError)

    Since I'm using RVM, for me, the answer was to create an rvm wrapper script for kramdown so the binary path and environments are set correctly. This is the command for my specific gem set and ruby version:

    rvm wrapper ruby-1.9.2-p290@blog blog kramdown

    That command creates this executable:

    /Users/mark/.rvm/bin/blog_kramdown

    ... and that's the binary path I used in Marked.

    It doesn't look like you're using RVM so your problem is likely different in solution but hopefully that helps point you in the right direction.

  4. 4 Posted by Henry Mercer on 30 Dec, 2011 11:33 AM

    Henry Mercer's Avatar

    I have rbenv installed but am using the system ruby installation as rbenv requires additional environmental variables etc. I checked /usr/bin and sure enough, there was a kramdown executable there. Inputted it into Marked and it works fine! Thanks for the suggestion.

    I checked Console, and I was getting a similar problem to Mark:

    29/12/2011 22:14:38.194 [0x0-0xfc0fc].com.brettterpstra.marky: /Library/Ruby/Gems/1.8/gems/kramdown-0.13.4/bin/kramdown:25:in `require': no such file to load -- kramdown (LoadError)

  5. Support Staff 5 Posted by Brett on 30 Dec, 2011 01:56 PM

    Brett's Avatar

    Glad that's working. I'm trying to find a way to pass environment variables when it shells out to run the command, but not having a lot of luck so far. Hopefully in a version soon.

    -Brett

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac