Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Edit: Easier now</h2> <p>as of Jekyll >= 0.12.1 redcarpet2 is natively supported by Jekyll, so you can simply set your config to <code>markdown: redcarpet</code> and you are good to go with GFM / fenced code blocks without the rest of this mumbojumbo...</p> <h2>Original answer</h2> <p>You explicitly ask for Github-flavored markdown, so I presume you aren't looking for answers that create code blocks with the non-markdown liquid format:</p> <pre><code>{% highlight python %} def yourfunction(): print "Hello World!" {% endhighlight %} </code></pre> <p>but would rather be able to write something with fenced code blocks:</p> <pre><code>```python def yourfunction(): print "Hello World!" ``` </code></pre> <p>etc. For this, you will want to use the <strong>redcarpet</strong> markdown parser. </p> <p>Github-flavored markdown uses a markdown parser called "Redcarpet" <a href="https://github.com/blog/832-rolling-out-the-redcarpet" rel="noreferrer">1</a>. Ironically, though Github flavored markdown uses <a href="https://github.com/vmg/redcarpet" rel="noreferrer">redcarpet2</a>, this markdown parser is not supported by Jekyll by default. Instead, you can add this as a plugin by installing that ruby gem </p> <pre><code>gem install redcarpet </code></pre> <p>and then adding the <a href="https://github.com/nono/Jekyll-plugins" rel="noreferrer">redcarpet2 Jekyll plugin</a>. (Installing a plugin in Jekyll amounts to placing the <code>.rb</code> ruby script given in that repository into your <code>_plugins</code> directory. Can be in a subdirectory of <code>_plugins</code> too). </p> <p>Then, as explained on the documentation there, edit your <code>_config.yml</code> to use redcarpet2: </p> <pre><code>markdown: redcarpet2 redcarpet: extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "strikethrough", "superscript"] </code></pre> <p>which adds the common extensions provided by github-flavored-markdown aka redcarpet2 (Well, almost. This won't do github specific markdown things like identify issues by number, or commits by hash, so they aren't technically the same). </p> <p>Having the plugin means, for the moment, you will have to build your site locally and copy the <code>_site</code> to github if you are hosting your site there, as redcarpet2 isn't available on the Github version of the jekyll engine (see this <a href="https://github.com/mojombo/jekyll/issues/200" rel="noreferrer">open issue</a> on Jekyll)</p> <p><strong>Note</strong>: You don't need all the markdown editors you've specified in your <code>_config.yml</code> by the way. For a basic example using redcarpet2, you might want to see this <a href="https://github.com/cboettig/labnotebook/blob/a52ec003d4a55c87b1284da60558831458ca5be8/_config.yml" rel="noreferrer">config</a> and the associated jekyll directory that goes with it. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload