Skip to content

Instantly share code, notes, and snippets.

@rubylaser
Last active December 30, 2015 03:29
Show Gist options
  • Save rubylaser/7769297 to your computer and use it in GitHub Desktop.
Save rubylaser/7769297 to your computer and use it in GitHub Desktop.
$(".markdown_link").live("click", function(e) {
$(this).next(".markdown_examples").slideToggle();
});
<div class="formatting">
Use Markdown for formatting. <%= link_to "See examples.", "javascript:void(0)", :class => "markdown_link" %>
<div class="markdown_examples" style="display: none">
<table>
<tr>
<td><pre>[Link](http://example.com/)</pre></td>
<td><a href="http://example.com/">Link</a></td>
</tr>
<tr>
<td><pre>*Italic*</pre></td>
<td><em>Italic</em></td>
</tr>
<tr>
<td><pre>**Bold**</pre></td>
<td><strong>Bold</strong></td>
</tr>
<tr>
<td><pre>
* Listed
* Items
</pre></td>
<td><ul><li>Listed</li><li>Items</li></ul></td>
</tr>
<tr>
<td><pre>&gt; Block quote</pre></td>
<td><blockquote><p>Block quote</p></blockquote></td>
</tr>
<tr>
<td><pre>`Inline code`</pre></td>
<td><code>Inline code</code></td>
</tr>
<tr>
<td>
<pre>
``` ruby
puts "code block"
```
</pre>
</td>
<td><%= markdown("``` ruby\nputs \"code block\"\n```").html_safe %></td>
</tr>
</table>
</div>
</div>
.formatting {
font-size: 12px;
margin: 8px 0;
}
.markdown_examples {
margin-top: 5px;
}
.markdown_examples table {
border-collapse: collapse;
}
.markdown_examples table td {
border: solid 1px #CCC;
padding: 2px 10px;
}
.markdown_examples .code_block {
width: 200px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment