Can't get kramdown working

David EIffert's Avatar

David EIffert

Sep 19, 2014 @ 04:05 PM

Total rookie here, I'm sure I'm doing something dumb.

Here's what I've done.
* Installed Kramdown using - sudo gem install kramdown
* Opened marked preferences (2.4.4 non MAS version)
* Entered '/usr/bin/kramdown' in custom processor path
* Updated permissions
* When I try to enable to the custom processor I get "Error running custom processor".

24 second screencast: https://v.usetapes.com/BhzzVuR6RE

Any ideas?

 - David

  1. Support Staff 1 Posted by Brett on Sep 19, 2014 @ 04:10 PM

    Brett's Avatar

    The error you're receiving is "The encoding of the source text is not
    valid." What happens if you run (adjusting the path to the text file as
    necessary):

    cat "kramdown test.txt" | /usr/bin/kramdown

    -Brett

  2. 2 Posted by David EIffert on Sep 19, 2014 @ 04:21 PM

    David EIffert's Avatar
    <p>Joke  -  Timmy</p>
    
    <p>3rd Week - Series
<br />
    <strong>Forward</strong></p>
    
    <p>A simple paragraph with an ID attribute. {: #para-one}</p>
    Warning: Found span IAL after text - ignoring it
    Davids-MacBook-Air-3:Messx Outlines david$
    

    Thanks for the help Brett! You're basically my hero.

  3. 3 Posted by David EIffert on Sep 19, 2014 @ 04:25 PM

    David EIffert's Avatar

    Oh, here's the text file if that's helpful.

  4. Support Staff 4 Posted by Brett on Sep 19, 2014 @ 04:30 PM

    Brett's Avatar

    If you can attach the actual text file itself, I'll give it a test.

  5. 5 Posted by David EIffert on Sep 19, 2014 @ 04:34 PM

    David EIffert's Avatar

    :)

  6. Support Staff 6 Posted by Brett on Sep 19, 2014 @ 04:52 PM

    Brett's Avatar

    I get the same error with your text file, but not with others. Not sure why. However, if I use kramdown as a library in an executable script as the custom processor, it seems to work:

     #!/usr/bin/ruby
     require 'kramdown'
     input = STDIN.read.force_encoding('utf-8')
     puts Kramdown::Document.new(input).to_html
    

    I'm noting that the {: #id} isn't doing anything, though, even when I put it in the correct places. That's baffling me at the moment.

  7. Support Staff 7 Posted by Brett on Sep 19, 2014 @ 04:55 PM

    Brett's Avatar

    I take it back, it appears to be defaulting to the standard processor, indicating that the script is failing silently. Hrm.

    I'll do some more testing.

  8. Support Staff 8 Posted by Brett on Sep 19, 2014 @ 05:02 PM

    Brett's Avatar

    Ah, found it. If you have "Enable Leanpub support" turned on under Apps prefs, it will bork those {:.id} tags. Turn that off and that script seems to work fine.

  9. 9 Posted by David EIffert on Sep 19, 2014 @ 05:26 PM

    David EIffert's Avatar

    Using the executable script as the custom processor is working! Thanks so much.

    Upon further inspection of my original file, it looks like there's strange character after 'Series' that was messing it up. It was a copy/paste from scrivener. Wonder how that happened.

    I wonder if force encoding to utf-8 in the executable script as custom processor might have fixed that.

  10. Support Staff 10 Posted by Brett on Sep 19, 2014 @ 05:31 PM

    Brett's Avatar

    Yes, without the force_encoding it still breaks.

    -Brett

Reply to this discussion

Internal reply

        Formatting help / Preview (switch to plain text)

          You can attach files up to 10MB

            If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

              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