Cannot render table using kramdown when having Unicode characters in document

lequochung's Avatar

lequochung

01 Oct, 2013 10:48 AM

I have a very weird problem with rendering table in Marked when using kramdown as custom processor.

Basically, Marked renders a document contains only the table as below:

table only

and Marked renders the same document but contains both the table and some unicode text with characters like (ề, ả..) as follow:

table with text

Here is the raw text:

{:.table .table-bordered .table-striped}
|---
| # | Keys Combination | Value | Action | Meaning
|-|-|-|-|-
| 1  | Command + \] | ⌘ \] | Next Pane | Go To Next Panel|
| 2  | Command + \[ | ⌘ \[ | Previous Pane | Go To Previous Panel |
| 3  | Shift + Command + \] | ⇧ ⌘ \] | Next Tab | Go To Next Tab |
| 4  | Shift + Command + \[ | ⇧ ⌘ \[ | Previous Tab | Go To Previous Tab |
| 5  | Command + ← | ⌘ ← | Send ^\[ B  [^2] | Back 1 word |
| 6  | Command + → | ⌘ → | Send ^\[ F  [^3] | Next 1 word |
| 7  | Shift + Command + → | ⇧ ⌘ → | Send ^[ [F [^4] | End |
| 8  | Shift + Command + ← | ⇧ ⌘ ← | Send ^[ [H [^5] | Home |
| 9  | Shift + Delete | ⇧ Del  | Send ^[ D   [^6] | Forward Delete |
| 10 | Command + Z | ⌘ Z | Send Hexcode 0x17 [^7]| Delete Last Word |
| 11 | Shift + Command + Z | ⇧ ⌘ Z   | Send Hexcode 0x15 [^8]| Clear Command |

I'm using Marked 2 on Lion 10.8.5 at the moment and here is the Marked's Preferences:

Marked Preferences

Also, I'm pretty sure the problem is not footnotes inside table.

Thanks!

  1. Support Staff 1 Posted by Brett on 01 Oct, 2013 01:08 PM

    Brett's Avatar

    I tested with your settings (and other combinations), with and without definitions for the footnotes and ALWAYS got:

    This is with the Kramdown binary version 1.0.2. If you copy the table to your clipboard and run pbpaste|kramdown, does it work fine for you? Note that your RVM instance isn't loading, it's running whatever is installed for the system Ruby. That means that if you haven't installed the gem for system sudo gem install, it may not actually be running Kramdown at all.

  2. 2 Posted by lequochung on 02 Oct, 2013 08:13 AM

    lequochung's Avatar

    Hi Brett

    Thank you for the quick reply.

    I've tried to copy the raw text into the clipboard and run it with kramdown in the command line and looks like it works fine. Here is the result:

    <table class="table table-bordered table-striped">  
      <thead>
        <tr>
          <th>#</th>
          <th>Keys Combination</th>
          <th>Value</th>
          <th>Action</th>
          <th>Meaning</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>Command + ]</td>
          <td>⌘ ]</td>
          <td>Next Pane</td>
          <td>Go To Next Panel</td>
        </tr>
        <tr>
          <td>2</td>
          <td>Command + [</td>
          <td>⌘ [</td>
          <td>Previous Pane</td>
          <td>Go To Previous Panel</td>
        </tr>
        <tr>
          <td>3</td>
          <td>Shift + Command + ]</td>
          <td>⇧ ⌘ ]</td>
          <td>Next Tab</td>
          <td>Go To Next Tab</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Shift + Command + [</td>
          <td>⇧ ⌘ [</td>
          <td>Previous Tab</td>
          <td>Go To Previous Tab</td>
        </tr>
        <tr>
          <td>5</td>
          <td>Command + ←</td>
          <td>⌘ ←</td>
          <td>Send ^[ B  [^2]</td>
          <td>Back 1 word</td>
        </tr>
        <tr>
          <td>6</td>
          <td>Command + →</td>
          <td>⌘ →</td>
          <td>Send ^[ F  [^3]</td>
          <td>Next 1 word</td>
        </tr>
        <tr>
          <td>7</td>
          <td>Shift + Command + →</td>
          <td>⇧ ⌘ →</td>
          <td>Send ^[ [F [^4]</td>
          <td>End</td>
        </tr>
        <tr>
          <td>8</td>
          <td>Shift + Command + ←</td>
          <td>⇧ ⌘ ←</td>
          <td>Send ^[ [H [^5]</td>
          <td>Home</td>
        </tr>
        <tr>
          <td>9</td>
          <td>Shift + Delete</td>
          <td>⇧ Del</td>
          <td>Send ^[ D   [^6]</td>
          <td>Forward Delete</td>
        </tr>
        <tr>
          <td>10</td>
          <td>Command + Z</td>
          <td>⌘ Z</td>
          <td>Send Hexcode 0x17 [^7]</td>
          <td>Delete Last Word</td>
        </tr>
        <tr>
          <td>11</td>
          <td>Shift + Command + Z</td>
          <td>⇧ ⌘ Z</td>
          <td>Send Hexcode 0x15 [^8]</td>
          <td>Clear Command</td>
        </tr>
      </tbody>
    </table>  
    Warning: Footnote definition for '2' not found  
    Warning: Footnote definition for '3' not found  
    Warning: Footnote definition for '4' not found  
    Warning: Footnote definition for '4' not found  
    Warning: Footnote definition for '4' not found  
    Warning: Footnote definition for '5' not found  
    Warning: Footnote definition for '5' not found  
    Warning: Footnote definition for '5' not found  
    Warning: Footnote definition for '6' not found  
    Warning: Footnote definition for '6' not found  
    Warning: Footnote definition for '7' not found  
    Warning: Footnote definition for '8' not found
    

    If this means kramdown is running properly, then what would be the problem?

    Also, FYI

    $ which kramdown
    => /usr/local/rvm/gems/ruby-1.9.3-p448/bin/kramdown
    
    $ kramdown --version
    => 1.2.0
    

    So looks like I'm using a different version of Kramdown, will that be something to look at as well?

    Note that your RVM instance isn't loading, it's running whatever is installed for the system Ruby. That means that if you haven't installed the gem for system sudo gem install, it may not actually be running Kramdown at all.

    Could you please explain the above part a bit more in detailed, I'm fairly new to ruby and having a hard time with using rvm, I have a bunch of different ruby versions installed all over my system and it's hard to tell which one is being used by what program...

    Thanks! I appreciate your help!

  3. Support Staff 3 Posted by Brett on 02 Oct, 2013 04:31 PM

    Brett's Avatar

    Run:

    rvm use system
    sudo gem install kramdown

    Then make sure you have a binary at /usr/local/bin/kramdown and set your custom processor to that.

    Let me know if it helps.

    -Brett

  4. 4 Posted by lequochung on 02 Oct, 2013 04:53 PM

    lequochung's Avatar

    Hi Brett

    After running

    $ rvm use system 
    $ sudo gem install kramdown
    

    I don't see any kramdown binary in /usr/local/bin/

    When I run

    $ which kramdown
    

    I still get /usr/local/rvm/gems/ruby-1.9.3-p448/bin/kramdown instead. Should I make /usr/local/bin/kramdown a symlink to this binary?

    Thanks!

  5. 5 Posted by lequochung on 02 Oct, 2013 05:00 PM

    lequochung's Avatar

    Hi Brett

    Just double checked and looks like kramdown was already installed before that, but in

    /usr/bin/
    

    However, it wasn't executable though, so I had to run

    chmod u+x /usr/bin/kramdown
    

    then use /usr/bin/kramdown as the binary path for the custom processor and now everything is working as expected.

    This also solved my original problem, too! :)
    Thanks for looking in to this!

    Cheers!

  6. Support Staff 6 Posted by Brett on 02 Oct, 2013 05:36 PM

    Brett's Avatar

    No problem! Glad to hear it's working.

  7. lequochung closed this discussion on 02 Oct, 2013 05:37 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