I cannot get the Custom Processor working

Roderik van der Veer's Avatar

Roderik van der Veer

15 Nov, 2011 09:39 AM

I followed the guide in the KB but Marked is not using the new renderer.

The command in Terminal works: https://gist.github.com/c802450c98cd0e41e5b6

In the prefs the processor line is: /Users/roderik/.rvm/bin/ruby /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb
http://rdrk.eu/2g1p0m1v3i0c0X3I1C0A

The html Marked produces: https://gist.github.com/d93f0f86ebaf77f21a9b

The code blocks are different.

  1. Support Staff 1 Posted by Brett on 15 Nov, 2011 02:29 PM

    Brett's Avatar

    Hi Roderik,

    Sorry for any confusion. The custom processor does not take arguments.
    You need to make the hashbang in the script point to your rvm
    environment, make the script executable and then make it work with the
    contents piped to it rather than read from a file. In the end you should
    have one single command that would be the equivalent of `cat myfile.md |
    your/script.rb` and output goes to STDOUT.

  2. 2 Posted by Roderik van der... on 15 Nov, 2011 02:43 PM

    Roderik van der Veer's Avatar

    Hmm, still does not output the same as the commandline

    In the preferences i have now:
    /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb

    Running cat /opt/kDeploy/README.md | /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb returns in STOUT

    <div class="highlight">
    <pre><span class="nv">$ </span>sudo su -
    <span class="nv">$ </span><span class="nb">cd</span> /opt
    <span class="nv">$ </span>wget -q -O - <span class="s2">"https://raw.github.com/Kunstmaan/kDeploy/master/installations/basic-machine"</span> | bash
    <span class="nv">$ </span>wget -q -O - <span class="s2">"https://raw.github.com/Kunstmaan/kDeploy/master/installations/puppet-client"</span> | bash
    </pre>
    </div>

    Marked returns

    <p><code>bash
    $ sudo su -
    $ cd /opt
    $ wget -q -O - &quot;https://raw.github.com/Kunstmaan/kDeploy/master/installations/basic-machine&quot; | bash
    $ wget -q -O - &quot;https://raw.github.com/Kunstmaan/kDeploy/master/installations/puppet-client&quot; | bash
    </code></p>

    Is there some way to see what it is doing in for example Console? Since it does not give an error, but shows me "default" markdown, i think it is not executing the custom processor script.

  3. 3 Posted by Roderik van der... on 15 Nov, 2011 02:48 PM

    Roderik van der Veer's Avatar

    Ok, it still shows html but no "view" anymore. Console shows

    15/11/11 15:45:13,432 [0x0-0x39039].com.brettterpstra.marky: /Users/roderik/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- redcarpet (LoadError)

    getting closer :)

    On 15 Nov 2011, at 15:42, Roderik van der Veer wrote:

    > Hmm, still does not output the same as the commandline
    >
    > In the preferences i have now:
    > /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb
    >
    > Running cat /opt/kDeploy/README.md | /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb returns in STOUT
    >
    > <div class="highlight">
    > <pre><span class="nv">$ </span>sudo su -
    > <span class="nv">$ </span><span class="nb">cd</span> /opt
    > <span class="nv">$ </span>wget -q -O - <span class="s2">"https://raw.github.com/Kunstmaan/kDeploy/master/installations/basic-machine"</span> | bash
    > <span class="nv">$ </span>wget -q -O - <span class="s2">"https://raw.github.com/Kunstmaan/kDeploy/master/installations/puppet-client"</span> | bash
    > </pre>
    > </div>
    >
    > Marked returns
    >
    > <p><code>bash
    > $ sudo su -
    > $ cd /opt
    > $ wget -q -O - &quot;https://raw.github.com/Kunstmaan/kDeploy/master/installations/basic-machine&quot; | bash
    > $ wget -q -O - &quot;https://raw.github.com/Kunstmaan/kDeploy/master/installations/puppet-client&quot; | bash
    > </code></p>
    >
    > Is there some way to see what it is doing in for example Console? Since it does not give an error, but shows me "default" markdown, i think it is not executing the custom processor script.
    >
    >
    > On 15 Nov 2011, at 15:29, Brett wrote:
    >
    >>

  4. Support Staff 4 Posted by Brett on 15 Nov, 2011 03:00 PM

    Brett's Avatar

    Do you have the redcarpet gem installed across all of your RVM installations? `rvm do gem install redcarpet`?

    -Brett

  5. 5 Posted by Roderik van der... on 15 Nov, 2011 03:27 PM

    Roderik van der Veer's Avatar

    Yes (did it again to be sure)

    Fixed it by adding a bash script in between, seems like Marked does not run with the same env variables as the terminal user.

    #!/bin/bash

    export GEM_PATH=/Users/roderik/.rvm/gems/ruby-1.9.3-p0:/Users/roderik/.rvm/gems/ruby-1.9.3-p0@global
    export GEM_HOME=/Users/roderik/.rvm/gems/ruby-1.9.3-p0

    cat - | /Users/roderik/Dropbox/Databases/github-flavored-markdown.rb

  6. Brett closed this discussion on 20 Nov, 2011 03:35 PM.

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