Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions disabled in IRB? #33

Closed
deep-spaced opened this issue Jan 30, 2017 · 3 comments
Closed

Extensions disabled in IRB? #33

deep-spaced opened this issue Jan 30, 2017 · 3 comments

Comments

@deep-spaced
Copy link
Contributor

Greetings and thanks for all your work on this gem! I've been using it in one of our projects for some time and it has been excellent. Looking back around for table syntax support I noticed today that 0.14.2 has tests for Markdown table syntax so I jumped in and started fiddling. Unfortunately, I can't seem to get the table extension working correctly and I hoped you might have some idea what I'm doing wrong.

I'm using Ruby 2.3.1 and commonmarker at 0.14.2. Cloning the repo and running the tests returned a green light on all of them.

Here's my test script:

require 'commonmarker'
include CommonMarker

@markdown = <<-MD
    One extension:
    | a   | b   |
    | --- | --- |
    | c   | d   |
    | **x** | |
    Another extension:
    ~~hi~~
MD

puts CommonMarker.render_html(@markdown, :default, %i[table])

Here's the output:

<pre><code>One extension:
| a   | b   |
| --- | --- |
| c   | d   |
| **x** | |
Another extension:
~~hi~~
</code></pre>

Any thoughts? Thanks for your time!

@gjtorikian
Copy link
Owner

gjtorikian commented Jan 30, 2017

@kivikakk, any ideas here? You've done all the extensions stuff. 😁

@kivikakk
Copy link
Collaborator

Hey, yeah! The leading spaces are causing the entire input to be treated as a code block — note the <pre><code> in the output. Try unindenting the input and see if that helps!

@deep-spaced
Copy link
Contributor Author

Thanks, @kivikakk and @gjtorikian! I got both extensions working using the following.

require 'commonmarker'
include CommonMarker

@markdown = <<-MD
One extension:

| a   | b   |
| --- | --- |
| c   | d   |
| **x** | |

Another extension:
~~hi~~
MD

puts CommonMarker.render_html(@markdown, :default, %i[table strikethrough])
<p>One extension:</p>
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>c</td>
<td>d</td>
</tr>
<tr>
<td><strong>x</strong></td>
<td></td>
</tr></tbody></table>
<p>Another extension:
<del>hi</del></p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants